Passwordless ssh to CentOS 7

Issues related to configuring your network
Post Reply
gosvald
Posts: 6
Joined: 2019/01/25 22:06:24

Passwordless ssh to CentOS 7

Post by gosvald » 2019/01/25 22:30:59

Hi Guys,

I replaced my OpenSuSe server with CentOS 7 a couple of days ago. Trying to replicate passwordless authentication to run backups with rsync.
I have done:
ssh-keygen -t rsa
chmod 700 ~/.ssh
chmod 600 ~/.ssh/id_rsa
ssh-copy-id -i user@192.168.1.3
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys
restorecon -Rv ~/.ssh

Still no bananas. I am still asked for password.
Anything else I might have missed?

User avatar
TrevorH
Site Admin
Posts: 33215
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Passwordless ssh to CentOS 7

Post by TrevorH » 2019/01/26 02:36:08

Check /var/log/secure on the server to see if it logs any errors there.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

gosvald
Posts: 6
Joined: 2019/01/25 22:06:24

Re: Passwordless ssh to CentOS 7

Post by gosvald » 2019/01/26 08:49:18

That's a first thing I did. Nothing there really. When I try to log in and do not enter the password:

Did not receive identification string from 192.168.1.2 port 57604
Connection closed by 192.168.1.2 port 57606 [preauth]

If I enter the password:

Accepted password for backup from 192.168.1.2 port 57640 ssh2
pam_unix(sshd:session): session opened for user backup by (uid=0)

Regards,

George

hunter86_bg
Posts: 2019
Joined: 2015/02/17 15:14:33
Location: Bulgaria
Contact:

Re: Passwordless ssh to CentOS 7

Post by hunter86_bg » 2019/01/26 09:03:05

Why do use chmod? Usually ssh-keygen & ssh-copy-id are doing a great job.
Just remove the authorized key file on destination, create a new pair and use ssh-copy-id -i new_pair.pub user@backup and it should work.

gosvald
Posts: 6
Joined: 2019/01/25 22:06:24

Re: Passwordless ssh to CentOS 7

Post by gosvald » 2019/01/26 10:44:24

I tried that. I tried many other things as well. I have been running this with openSUSE without a problem for three years. My first attempt was simply:
ssh-keygen (without password)
ssh-copy-id -i user@192.168.1.3

It does not work.

gosvald
Posts: 6
Joined: 2019/01/25 22:06:24

Re: Passwordless ssh to CentOS 7

Post by gosvald » 2019/01/26 11:10:59

I do not have the entry: "RSAAuthentication yes" in "/etc/ssh/sshd_config" on the server. I believe that was deprecated. Is that a problem?

hunter86_bg
Posts: 2019
Joined: 2015/02/17 15:14:33
Location: Bulgaria
Contact:

Re: Passwordless ssh to CentOS 7

Post by hunter86_bg » 2019/01/26 17:25:45

How old is the remote system?
Try with 'ssh-keygen -t dsa'
ssh-copy-id -i pub root@remote

gosvald
Posts: 6
Joined: 2019/01/25 22:06:24

Re: Passwordless ssh to CentOS 7

Post by gosvald » 2019/01/26 21:25:25

Remote system is brand new. Installed "CentOS-7-x86_64-DVD-1810.iso" three days ago. I tried dsa instead of rsa already and that does not work either. For both I can only log in with password.

gosvald
Posts: 6
Joined: 2019/01/25 22:06:24

Re: Passwordless ssh to CentOS 7

Post by gosvald » 2019/01/27 21:56:59

All working now. The problem was with a remote user. Once I fixed that, the login works fine.

Post Reply