I have a problem getting key authentication to work with one remote user (git), even though it works fine for the remote user "root". The remote file .ssh/authorized_keys is identical for both users - I cp'ed it from the root account to the git home dir.
On local machine (OS X, by the way) I have: $ cd $ ls -l .ssh -rw------- 1 jussihirvi staff 668 Aug 24 16:13 id_rsa (the rest is omitted)
On remote machine (as root): $ cd $ ls -ld .ssh drwxr-xr-x 2 root root 4096 Feb 11 17:45 .ssh $ ls -l .ssh total 8 -rw------- 1 root root 1768 Feb 11 17:45 authorized_keys -rw-r--r-- 1 root root 631 Feb 11 12:30 known_hosts
On remote machine (as git): $ cd $ ls -ld .ssh drwxr-xr-x 2 git git 4096 Feb 12 11:15 .ssh $ ls -l .ssh total 8 -rw------- 1 git git 1768 Feb 12 10:52 authorized_keys -rw-r--r-- 1 git git 631 Feb 12 11:05 known_hosts
When, on local machine, I do: $ ssh root@remotehost I get in without a password. But when I do $ ssh git@remotehost I will be asked for a password.
What should I check?
- Jussi
2012/2/12 Jussi Hirvi greenspot@greenspot.fi:
I have a problem getting key authentication to work with one remote user (git), even though it works fine for the remote user "root". The remote file .ssh/authorized_keys is identical for both users - I cp'ed it from the root account to the git home dir.
On local machine (OS X, by the way) I have: $ cd $ ls -l .ssh -rw------- 1 jussihirvi staff 668 Aug 24 16:13 id_rsa (the rest is omitted)
On remote machine (as root): $ cd $ ls -ld .ssh drwxr-xr-x 2 root root 4096 Feb 11 17:45 .ssh $ ls -l .ssh total 8 -rw------- 1 root root 1768 Feb 11 17:45 authorized_keys -rw-r--r-- 1 root root 631 Feb 11 12:30 known_hosts
On remote machine (as git): $ cd $ ls -ld .ssh drwxr-xr-x 2 git git 4096 Feb 12 11:15 .ssh $ ls -l .ssh total 8 -rw------- 1 git git 1768 Feb 12 10:52 authorized_keys -rw-r--r-- 1 git git 631 Feb 12 11:05 known_hosts
When, on local machine, I do: $ ssh root@remotehost I get in without a password. But when I do $ ssh git@remotehost I will be asked for a password.
What should I check?
Check logs for sshd deamon first. It usually gives explanation about issue.
try also ssh -v git@remotehost for debug information.
-- Eero
On 12.2.2012 11.51, Eero Volotinen wrote:
Check logs for sshd deamon first. It usually gives explanation about issue.
Damn, that was simple. /var/log/secure tells it in plain language:
Authentication refused: bad ownership or modes for directory /var/www/railsdev
(that is the home dir for the user git). The perms were: $ ls -ld /var/www/railsdev drwxrws--- 5 git apache 4096 Feb 12 10:52 railsdev/
I did chmod g-w, and the key auth started to work! Thanks.
- Jussi