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 the public and private key shell code
- Ssh-keygen-t Dsa-p "-F ~/.SSH/ID_DSA
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 2.1 import native shell code
- Cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
2.2 Importing a server to password-free login
First copy the authentication file to the server
Shell Code
- SCP ~/.ssh/authorized_keys [email protected] Host name:/home/xxx/.ssh/
Generally more than a few steps on the OK, but I still have to enter the password,
Log file to view system with root User: $tail/var/log/secure-n 20
............
OCT 7 10:26:43 masterserver sshd[2734]: Authentication Refused:bad ownership or modes for File/home/hadooper/.ssh/autho Rized_keys
OCT 7 10:26:48 masterserver sshd[2734]: Accepted password for hadooper from:: 1 port 37456 SSH2
OCT 7 10:26:48 masterserver sshd[2734]: Pam_unix (sshd:session): Session opened for user Hadooper by (uid=0)
OCT 7 10:36:30 masterserver sshd[2809]: Accepted password for hadooper from 192.168.1.241 Port 36257 ssh2
OCT 7 10:36:30 masterserver sshd[2809]: Pam_unix (sshd:session): Session opened for user Hadooper by (uid=0)
OCT 7 10:38:28 masterserver sshd[2857]: Authentication Refused:bad ownership or modes for DIRECTORY/HOME/HADOOPER/.SSH
............
Tip/home/hadooper/.ssh and/home/hadooper/.ssh/authorized_keys permissions are not correct, modify the following: Shell code
- chmod ~/.ssh
- chmod ~/.ssh/authorized_keys
3. Testing
SSH host, the first login may require a Yes confirmation, and then you can log in directly.
Transferred from: http://blog.csdn.net/hwwn2009/article/details/39852457
CentOS Configuration ssh password-free login, still prompt to enter the password