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!
sshd_config
where you have your authorized keys. The default isAuthorizedKeysFile .ssh/authorized_keys
. Have you made any changes tossh_config
(notsshd_config
)?AuthorizedKeysFile
directivessh -vvv ...
./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.