LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (http://www.linuxquestions.org/questions/linux-software-2/)
-   -   ssh authorized keys from one directory to another directory did not worked (http://www.linuxquestions.org/questions/linux-software-2/ssh-authorized-keys-from-one-directory-to-another-directory-did-not-worked-840302/)

tkmsr 10-25-2010 07:14 AM

ssh authorized keys from one directory to another directory did not worked
 
I have an access to a machine on lan via ssh and I use key based authentication.I created one more account on the remote machine and copied


Code:

cp home/oldaccount/.ssh/authorized_keys home/newaccount/.ssh/authorized_keys
Now when I tried to login to the other account via ssh from my laptop it did not worked.Though the copy of keys from laptop .ssh/id_rsa.pub to
remote machine new account .ssh/authorized keys did worked.

I was wondering I had added same keys to old account so why did simple copying the authorized keys from one account to another did not worked.
Because when I did cat id_rsa.pub > authorized_keys in new account I had created same file which was in old account.
Why is this happening or my observation is wrong.

prayag_pjs 10-25-2010 07:28 AM

Try ssh -v remote ip you may get any clue also see /var/log/secure

djsmiley2k 10-25-2010 07:51 AM

Quote:

Originally Posted by http://www.snailbook.com/faq/publickey-userauth.auto.html
File and Directory Permissions
Here's an issue that frequently trips people up: by default, sshd has requirements for the permissions on the authorized_keys file, as well as its containing directory ~/.ssh, and the home directory. Specifically, none of these may be writable by any uid except the owner or root. That means the most permissive modes you can have here are:

$ chmod 755 ~
$ chmod 755 ~/.ssh
$ chmod 644 ~/.ssh/authorized_keys

The reason for caring about the directory permissions, is that it doesn't do much good to protect the authorized_keys file, if someone else can simply delete it and create a new one (by modifying the containing directories).

I think the permissions may of changed before/when you copied it :)

eSelix 10-25-2010 08:18 AM

And/Or owner and group of file. Change owner as newaccount, and check permissions.

tkmsr 10-25-2010 08:28 AM

Yes you all are right permissions were the problem.


All times are GMT -5. The time now is 10:49 PM.