[solved] ssh -Can´t log in with public key when started by systemd

Support for security such as Firewalls and securing linux
Post Reply
mibob2
Posts: 2
Joined: 2017/06/07 07:53:23

[solved] ssh -Can´t log in with public key when started by systemd

Post by mibob2 » 2017/06/07 09:06:15

Hi,
I´m running a Centos 7.2 server. For backup purposes I try to set up a typical rsync over ssh work environment. So I set up ssh to allow private/public key access. But whatever I did I was always prompted for the password. After double checking any settings file, the auth key files etc. I stopped ssh with

Code: Select all

service sshd stop
. Then I started sshd with

Code: Select all

/usr/sbin/sshd -D
to find out what might be wrong on the server side - to my surprise private/public key access works! Same with

Code: Select all

/usr/sbin/sshd
, login with private key works. Starting ssh

Code: Select all

service sshd start
I get the password prompt, restarting the system also doesn´t change the behaviour. So what must I add to systemd to make the public key access work? Other changes to

Code: Select all

/etc/ssh/sshd_config
like turning on and off root access via ssh are recognized by the systemd start/stop cycle. What am I missing?

Greetings,

Mike
Last edited by mibob2 on 2017/06/07 09:47:06, edited 1 time in total.

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

Re: ssh -Can´t log in with public key when started by systemd

Post by TrevorH » 2017/06/07 09:33:54

restorecon -r $USERHOMEDIR/.ssh
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

mibob2
Posts: 2
Joined: 2017/06/07 07:53:23

Re: [solved] ssh -Can´t log in with public key when started by systemd

Post by mibob2 » 2017/06/07 09:48:44

Hi,

Code: Select all

restorecon -r $USERHOMEDIR/.ssh
did the trick, thanks a lot!

Best regards,

Mike

Post Reply