CentOS Configuration ssh password-free login, still prompt to enter the password

Source: Internet
Author: User

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
    1. 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
    1. 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
    1. 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
    1. chmod ~/.ssh
    2. 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

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.