1827811 Members
2041 Online
109969 Solutions
New Discussion

Re: SSH Problem

 
Prashant Zanwar_2
Occasional Advisor

SSH Problem

Hi,

There are two systems A & B
I am generating SSH key using ssh_keygen in a file under my home directory.
This file I am taking from machine A to Machine B under my home /home/prashant/.ssh/authorized_keys.
Now if I try to do ssh harjit@b,
ideally this shall not ask for password, but it is asking...

I have checked file permissions and everything, bounced sshd and inetd...changed nsswitch.conf, no luck...

Error is given below:
Feb 24 06:51:41 bslgdc-linux1 sshd[6450]: Authentication refused: bad ownership or modes for directory /home/harjit

Please help..

Will assign points

Regards
Prashant
6 REPLIES 6
Alexander Chuzhoy
Honored Contributor

Re: SSH Problem

if you generate a file with ssh-keygen then you should append the content of your .ssh/id_dsa.pub into .ssh/authorized_keys file on destination machine. Is that what you did?
Prashant Zanwar_2
Occasional Advisor

Re: SSH Problem

yes i did cat id_dsa.pub >> authorized_keys

Regards
Prashant
Alexander Chuzhoy
Honored Contributor

Re: SSH Problem

it's because of your security -that's set on .ssh/authorized_keys file. It shouldn't be to "open" toherwise ssh is failing protectively
chmod it to 644
_
chmod the .ssh directory to 700
+
see that the owner of the .ssh/authorized_keys file is the correct owner.
Olivier Drouin
Trusted Contributor

Re: SSH Problem

Error is given below:
Feb 24 06:51:41 bslgdc-linux1 sshd[6450]: Authentication refused: bad ownership or modes for directory /home/harjit


SSH verifies *recursively* the permission settings down to "/".
Steven E. Protter
Exalted Contributor

Re: SSH Problem

You may have missed steps in the procedure.

Attaching a good doc. You can use cat >> instead of X windows.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Armin Kunaschik
Esteemed Contributor

Re: SSH Problem

Looks like the permissions of your local home directory are wrong.
Remove write-permission for group and world:

chmod go-w $HOME

If things don't work simply remove all
write permissions for group and world
of $HOME, $HOME/.ssh and $HOME/.ssh/* on
both server and client side.
This fixes 90% of my known ssh problems :-)

Regards,
Armin
And now for something completely different...