CentOS Setup ssh password-free login

Source: Internet
Author: User

Preparatory work:
1. Confirm the configuration file of native sshd (requires root permission)
$ gedit/etc/ssh/sshd_config
Find the following and remove the comment "#"
Rsaauthentication Yes
Pubkeyauthentication Yes
Authorizedkeysfile. Ssh/authorized_keys
2. If you modify the configuration file, you need to restart the sshd service (requires root permission)
$/sbin/service sshd Restart


Configuring SSH password-free login takes 3 steps:
1. Generate public and private keys
2. Import the public key to the authentication file, change the permissions
3. Testing


1. Generate public and private keys
Shell code: SSH-KEYGEN-T RSA

The default is to generate two files in the ~/.ssh directory:
Id_rsa: Private key
Id_rsa.pub: Public Key


2. Import the public key to the authentication file, change the permissions
2.1 Importing this machine
Shell code: Cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys


2.2 Importing a server to password-free login
First copy the public key to the server
Shell code: SCP ~/.ssh/id_rsa.pub [Email protected]:/home/id_rsa.pub


Then, import the public key into the authentication file (this step is done on the server)
Shell code: Cat/home/id_rsa.pub >> ~/.ssh/authorized_keys

2.3 Changing permissions on the server
Shell code: chmod ~/.ssh
chmod ~/.ssh/authorized_keys

CentOS Setup ssh password-free login

Related Article

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.