FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > CentOS > CentOS

 
 
LinkBack Thread Tools
 
Old 02-12-2012, 08:34 AM
Jussi Hirvi
 
Default Key auth question

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

--
Jussi Hirvi * Green Spot
Suvilahdenkatu 1 B 78 * 00500 Helsinki * Finland
Tel. +358 9 493 981 * Mobile +358 40 771 2098 (only sms)
jussi.hirvi@greenspot.fi * http://www.greenspot.fi
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 02-12-2012, 08:36 AM
Jussi Hirvi
 
Default Key auth question

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
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 02-12-2012, 08:51 AM
Eero Volotinen
 
Default Key auth question

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
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 02-12-2012, 09:40 AM
Jussi Hirvi
 
Default Key auth question

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
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 

Thread Tools




All times are GMT. The time now is 12:37 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org