I have a server with Ubuntu 14.04 x64 operation system.
Part of my sshd_config
file (entire file):
Port 2202
Protocol 2
PermitRootLogin without-password
StrictModes yes
RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile /etc/ssh/keys/%u/authorized_keys
RhostsRSAAuthentication no
PermitEmptyPasswords no
ChallengeResponseAuthentication no
#PasswordAuthentication yes
UsePAM yes
In folder /etc/ssh/keys
each system user has its own folder with authorized_keys
file:
ls -l /etc/ssh/keys
drw------- 2 test.com test.com 4096 Nov 20 06:53 test.com
drw------- 2 root root 4096 Nov 20 02:29 root
The permissions of these authorized_keys files are correct:
ls -l /etc/ssh/keys/*
/etc/ssh/keys/test.com:
total 4
-r-------- 1 test.com test.com 960 Nov 20 07:17 authorized_keys
/etc/ssh/keys/root:
total 4
-r-------- 1 root root 395 Nov 20 02:29 authorized_keys
I have the same public id_rsa in root's and test.com's authorized_keys file.
I can login with root through ssh, but with test.com I am prompted for password.
Here is the debug info when trying to connect with test.com user:
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /Users/Ivan/.ssh/id_rsa
debug1: Authentications that can continue: publickey,password
debug1: Trying private key: /Users/Ivan/.ssh/id_dsa
debug1: Next authentication method: password
When I try to login with root I succeed:
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /Users/Ivan/.ssh/id_rsa
debug1: Server accepts key: pkalg ssh-rsa blen 279
debug1: Authentication succeeded (publickey).
I have Googled a lot of things. Couldn't find anything that solves my problem.
I have a script which creates system users using useradd
command and these users are without passwords by default.
I've found that system users without password may not login through ssh so I added password to test.com user. Didn't work.
I saw that UsePAM yes
may be a problem. I set it to UsePAM no
. Didn't work.
And yes, I did service ssh restart
after each change to the sshd_config
file.
I think I've tried everything and now I am clueless.
Any help will be appreciated!
I am a little bit curious about
– SailorCire Nov 20 '14 at 15:09sshd_config
where you have your authorized keys. The default isAuthorizedKeysFile .ssh/authorized_keys
. Have you made any changes tossh_config
(notsshd_config
)?AuthorizedKeysFile
directive – Ivan Dokov Nov 20 '14 at 15:12ssh -vvv ...
. – slm Nov 20 '14 at 15:31vi .ssh/authorized_keys
or doingssh-copy-id root@server
? maybe if you do the first one you made a typo – maniat1k Nov 20 '14 at 19:42/var/log/auth.log
, but check any log file that gets modified by the login attempt). Edit your question and copy-paste the entries that are generated by the login attempt. – Gilles 'SO- stop being evil' Nov 20 '14 at 23:36root/authorized_keys
totest.com/authorized_keys
, they are identical. @slm I used -vvv and I showed the important output at my question. @Gilles when try to connect nothing is showing in auth.log. When I am prompted for password I cancel the login attempt and I see this result:sshd[9138]: Connection closed by *.*.*.* [preauth]
– Ivan Dokov Nov 21 '14 at 07:55/Users/Ivan/.ssh/id_rsa
). Does both users have the same private key in their respective ~/.ssh? what are the permissions of Ivan's .ssh/id_rsa or the name of the private key to that public key? – YoMismo Nov 21 '14 at 09:05/Users/Ivan/.ssh/id_rsa
is my local private key owned by user Ivan (my local user). On the server I have the public key of Ivan user for both users root and test.com with proper permissions. I can login with root, I cannot login with test.com (prompted for password) – Ivan Dokov Nov 21 '14 at 09:15/etc/ssh/keys/test.com
and/etc/ssh/keys/test.com/authorized_keys
? – YoMismo Nov 21 '14 at 09:47/etc/ssh/keys/test.com/authorized_keys
and copy/etc/ssh/keys/root/authorized_keys
to/etc/ssh/keys/test.com
, modify user to test.com and see what happens? – YoMismo Nov 21 '14 at 10:56