ssh key login centos 7

General support questions
Post Reply
tran bao
Posts: 1
Joined: 2018/10/17 16:56:18

ssh key login centos 7

Post by tran bao » 2018/10/17 17:12:56

hello every one,

i'm trying to login to centos 7 using SSH key generated by putty gen.but every time i login the centos asks for password.below are my steps. please help me.
1. generating apair key by using putty gen
2. create /root/.ssh/authorized_keys
3.chmod 700 .ssh
chmod 600 .ssh/authorized_keys
4. copy public key to authorized_keys

User avatar
avij
Retired Moderator
Posts: 3046
Joined: 2010/12/01 19:25:52
Location: Helsinki, Finland
Contact:

Re: ssh key login centos 7

Post by avij » 2018/10/17 17:33:11

Make sure your permissions are still OK after copying the public key in place (if you cp it instead of pasting the key into the file)

Also, make sure your SELinux contexts are OK. Try restorecon -v -R /root/.ssh

If this does not help, what does grep ^PermitRootLogin /etc/ssh/sshd_config output?

The server's /var/log/secure and/or /var/log/messages may also have some hints of the problem.

gjaltemba
Posts: 49
Joined: 2016/11/29 15:23:25

Re: ssh key login centos 7

Post by gjaltemba » 2018/10/17 19:10:47

Run ssh -vvvv mysshserver to turn debug on.

See anything interesting in log?

Post Reply