Linux Basic practices

Source: Internet
Author: User

Linux Basic practices

1.1 Application Installation

Requirements: Master the Maintenance method of the software source, configure the system to use the software source image. Master the method of finding, installing, uninstalling and updating software through software sources .

back up the original address list file:sudo cp/etc/apt/sources.list/etc/apt/sources.list.old

Modify list file:sudo gedit/etc/apt/sources.list

Source:

Deb Http://mirrors.163.com/ubuntu/trusty main Multiverse restricted universe
Deb Http://mirrors.163.com/ubuntu/trusty-security main Multiverse restricted universe
Deb Http://mirrors.163.com/ubuntu/trusty-updates main Multiverse restricted universe
Deb http://mirrors.163.com/ubuntu/trusty-proposed Universe restricted Multiverse main
Deb Http://mirrors.163.com/ubuntu/trusty-backports main Multiverse restricted universe

Copy into Sources.list

Update Database sudo apt-get update (web too slow finally gave up whining)

Find a package that contains some keywords: sudo apt-cache search < The name> you are looking for

Installation software: sudo apt-get install PackageName

Uninstall software: sudo apt-get remove PackageName

Upgrade Package: sudo apt-get-u install PackageName

?

1.2 User Rights Management

Requirements: Mastering the concept of Linux rights Management. Master the meaning and setting method of 9bit related to rights management. Master the use of chmod and chown instructions. Master the user and user group maintenance methods. Modify the boot script or write the script. Understand and modify the PATH environment variable.

The meaning of 9bit refers to this picture

Enter root mode: sudo su

3 different access rights: readable (R), writable (w), and executable (x).

3 different user levels: the file owner (U), the owning user Group (g), and the other User (O) in the system.

The first character shows the type of file:

"-" indicates a normal file.

"D" represents a catalog file.

"L" means the linked file.

"C" indicates a character device.

"B" represents a block device.

"P" indicates a named pipe, such as a FIFO file (first-in, in-out).

"F" represents a stack file, such as LIFO (LIFO).

"s" means socket

Then there are three three-bit character groups:

The first three-bit character group represents the file owner (U) permissions on the file.

The second three-bit character group represents the file user Group (g) permissions on the file.

The third three-bit character group represents the permissions of other users of the system (O) to the file.

Show "-" when no permissions are present.

?

chmod: Changing the access rights of a file

Format: chmod [who] [+ |-| =] [mode] File name

[who]: U owner G Group member O other member a owner

[+ |-| =]: = re-set permissions-: Reduce permissions +: Increase permissions

[Mode]: The permissions that can be performed, which can be "R" (read-only), "W" (writable), and "X" (executable), and their combination.

, after the root permission, change the access rights of examples.desktop, add the writable permission of the owning user group

?

Chown: Modifying file owners and groups

Format: chown [parameter]< user name > (:< user Group name >) < file name >

Parameter:-r: Recursive change owner of directory

-F: Do not show the owner's details

, root user black wants to add a new user white

Create User: Useradd user name

Set Password: passwd user name

After that, change the owner of the Examples.desktop to white

CAT/ETC/PASSWD (later Black added a new user yellow, found White,yellow all at the bottom of the list)

Create group: Groupadd Group name

GREP Group name Storage address (/etc/group)

Perverted group Creation Complete

Delete User: Userdel user name

Delete Group: Groupdel Group name

Yellow, the kids and the freaks are all erased.

Write a script

?

1.3 SSH Service

Requirements: Properly install the SSH service and understand the configuration file. Use the command line to start or stop the appropriate service, and from the test can be normal from remote access

A new virtual machine was installed because the previous virtual machine and host were unable to connect

Installing the SSH service: sudo apt-get install Openssh-server

Open SSH service: sudo/etc/init.d/ssh start

Verify that the turn on is successful: Ps–ef |grep ssh 3533 that sentence means success.

Go to SSH config file: vi/etc/ssh/ssh_config

Host *

Host is valid only for computers that can match the following string. "*" means all computers.

Forwardagent: Sets whether the connection is forwarded to the remote computer through the authentication agent (if present).

FORWARDX11: Sets whether the X11 connection is automatically redirected to a secure channel and display set.

Rhostsauthentication: Sets whether to use rhosts-based security authentication.

Rhostsrsaauthentication: Sets whether to use rhosts-based security authentication with the RSA algorithm.

Rsaauthentication: Sets whether to use the RSA algorithm for security verification.

Passwordauthentication: Sets whether to use password authentication.

Fallbacktorsh: Sets If an error is automatically using rsh if an SSH connection occurs.

Usersh: Sets whether to use "Rlogin/rsh" on this computer.

Batchmode: If set to "yes", the hint of passphrase/password (interactive input password) will be disabled. This option is useful for script files and batch processing tasks when passwords cannot be entered interactively.

Checkhostip: Set SSH to see the IP address of the host connected to the server to prevent DNS spoofing. The recommended setting is "yes".

Stricthostkeychecking: If set to "Yes", SSH will not automatically add the computer's key to the "$HOME/.ssh/known_hosts" file, and once the computer's key has changed, refused to connect.

Identityfile: Sets the file from which to read the user's RSA Security authentication identity.

PORT: Set the ports to connect to the remote host.

Cipher: Set password for encryption

?

To turn services on or off using the command service * * Start/stop

Querying Linux virtual machine IP using ifconfig

The IP input putty, and then enter the password, display can be normal remote access

1.4 Authentication

Requirement: Authentication is implemented using username/password and certificate separately

Using RSA encryption: SSH-KEYGEN-T RSA

Ssh-keygen: Generate, manage, and convert authentication keys, including RSA and DSA two keys, specified with-t option

This command will generate the key file and the private key file Id_rsa,id_rsa.pub, which are in the Invisible folder, so we have to copy them into the Visual folder, and then transfer them through WINSCP to the host

Choose Save Private key, save the private key, select Advanced/ssh/Authentication in the WinSCP login interface, select the private key file that you just generated

?

1.5 Remote transmission

Requirements: Use WINSCP Client connection and file transfer; Putty in Windows can run the Xwindows program.

Remote transfer, using WINSCP client

Successful access, so they can freely transfer data

Install Xming-6-9-0-31-setup.exe, display the icon as follows

Configuring putty, modifying X11

Then follow the previous steps to connect, then you can open the application, which is opened in Firefox

?

Linux Basic practices

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.