Preparations:
1. Confirm the local sshd configuration file (requires root permissions)
$ gedit /etc/ssh/sshd_config
Find the following, and remove the comment "#"
RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile .ssh/authorized_keys
2. If modified The configuration file needs to restart the sshd service (requires root permissions)
$ /sbin/service sshd restart
Configuring SSH passwordless login requires 3 steps:
1. Generate public key and private key
2. Import the public key into the authentication file, change permissions
3. Test
1 .Generate public key and private key
Shell code: ssh-keygen -t rsa generates two files in the ~/.ssh directory by default: id_rsa : private key id_rsa.pub : public key 2. Import the public key into the authentication file, change permissions 2.1 Import the native shell code: cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys 2.2 Import the server for password-free login First copy the public key to the server
Shell code: scp ~/.ssh/id_rsa.pub xxx@host:/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 Change permissions on the server Shell code: chmod 700 ~/.ssh chmod 600 ~/.ssh/authorized_keys
centos password-free login
Guess you like
Origin http://43.154.161.224:23101/article/api/json?id=326180408&siteId=291194637
Recommended
Ranking