After configuring SSH password-free login for CentOS, you are still prompted to enter the password

Source: Internet
Author: User

After configuring SSH password-free login for CentOS, you are still prompted to enter the password

Perform the following three steps to configure SSH password-less logon in CentOS:

  1. Generate public and private keys
  2. Import the public key to the authentication file and change the permission
  3. Test

1. Generate public and private keys

Ssh-keygen-t dsa-p'-f ~ /. Ssh/id_dsa

The default value is ~ /. 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 Local Machine

Cat ~ /. Ssh/id_rsa.pub> ~ /. Ssh/authorized_keys

2.2 import the server for password-free Login

First, copy the authentication file to the server.

Scp ~ /. Ssh/authorized_keys xxx @ host name:/home/xxx/. ssh/

Generally, the above steps are OK, but I still need to enter the password,

Log on to the root user to view the system's log file: $ tail/var/log/secure-n 20

............

Oct 7 10:26:43 MasterServer sshd [2734]: Authentication refused: bad ownership or modes for file/home/hadoship/. ssh/authorized_keys
Oct 7 10:26:48 MasterServer sshd [2734]: Accepted password for hadoworkflow from: 1 port 37456 ssh2
Oct 7 10:26:48 MasterServer sshd [2734]: pam_unix (sshd: session): session opened for user hadoidentified by (uid = 0)
Oct 7 10:36:30 MasterServer sshd [2809]: Accepted password for hadostrap from 192.168.1.241 port 36257 ssh2
Oct 7 10:36:30 MasterServer sshd [2809]: pam_unix (sshd: session): session opened for user hadoidentified by (uid = 0)
Oct 7 10:38:28 MasterServer sshd [2857]: Authentication refused: bad ownership or modes for directory/home/hadoworkflow/. ssh

............

The prompt "/home/hadooper/. ssh" and "/home/hadoys/. ssh/authorized_keys" is incorrect. The modification is as follows:

Chmod 700 ~ /. Ssh
Chmod 600 ~ /. Ssh/authorized_keys

3. Test
Ssh host, the First Login may require yes confirmation, and then you can log on directly.

 

How to Improve the SSH login authentication speed of Ubuntu

 

Enable the SSH service to allow Android phones to remotely access Ubuntu 14.04

 

How to add dual authentication for SSH in Linux

 

Configure the SFTP environment for non-SSH users in Linux

 

Configure and manage the SSH service on Linux

 

Basic SSH tutorial

 

Linux SSH command instance Guide

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.