Application of SSH for server management

Source: Internet
Author: User

One, disable password login

Modify/etc/ssh/sshd_config:

Will passwordauthentication Yes

Modified to Passwordauthentication No

The SSHD service can be re-started.

Second, generate key file

Use the Ssh-keygen command to produce pub files.

SSH-KEYGEN-T Rsa-b 2048

-T RSA specifies the encryption method, the-B 2048 key bits.

Always enter to generate a id_rsa.pub file without a password. File location defaults to ~/.ssh/id_rsa.pub

Third, install the key

Use the Ssh-copy-id command to install the key file to the remote server.

Ssh-copy-id-i ~/.ssh/id_rsa.pub [email protected] REMOTEIP is a server IP that requires password-free login.

If this is the first time you may be prompted, whether you need to add to the list of trusted hosts, the answer must be yes. The next step is to ask for the login password for the remote server. The input will be automatically installed after completion.

Note that this command uses Remote server port number 22nd by default, and if you change the port number, use the command

Ssh-copy-id-i ~/.ssh/id_rsa.pub "-p port [email protected]"

Enclose the port number in "" with the name of the login.

If the command succeeds, the Authorized_keys file is generated under the/root/.ssh/directory of the remote server. If this file is originally appended to the end of the file, you can log on to the remote server for authentication.

Four, password-free login remote server

I take the remote server IP address 192.168.1.110 as an example, the port number is 20022

Ssh-p 20022 [email protected]

The port number of the remote host after-p, if it is the default port 22, it can be added. Root is a remote login user, if the current use is the root user, log on remotely is also root, can be omitted. In order to not have an accident, it is recommended to use the full format, which is the form of user name @ip.

Five, dual-machine mutual trust

Two-machine mutual trust is to take the above steps on each server once, to achieve the two-machine password-free login effect.

This article is from the "Cool bit Linux" blog, so be sure to keep this source http://coolbyte.blog.51cto.com/8289854/1687996

Application of SSH for server management

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.