Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 10-25-2010, 07:14 AM   #1
Registered: Oct 2006
Distribution: Ubuntu,Open Suse,Debian,Mac OS X
Posts: 798

Rep: Reputation: 39
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

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/ 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 > authorized_keys in new account I had created same file which was in old account.
Why is this happening or my observation is wrong.
Old 10-25-2010, 07:28 AM   #2
Senior Member
Registered: Feb 2008
Location: Pune - India
Distribution: Fedora,RedHat,CentOS,Gentoo
Posts: 1,138
Blog Entries: 4

Rep: Reputation: 147Reputation: 147
Try ssh -v remote ip you may get any clue also see /var/log/secure
Old 10-25-2010, 07:51 AM   #3
Registered: Feb 2005
Location: Coventry, UK
Distribution: Home: Gentoo x86/amd64, Debian ppc. Work: Ubuntu, SuSe, CentOS
Posts: 343
Blog Entries: 1

Rep: Reputation: 72
Originally Posted by
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
Old 10-25-2010, 08:18 AM   #4
Senior Member
Registered: Oct 2009
Location: Wroclaw, Poland
Distribution: Arch, Kubuntu
Posts: 1,248

Rep: Reputation: 312Reputation: 312Reputation: 312Reputation: 312
And/Or owner and group of file. Change owner as newaccount, and check permissions.
Old 10-25-2010, 08:28 AM   #5
Registered: Oct 2006
Distribution: Ubuntu,Open Suse,Debian,Mac OS X
Posts: 798

Original Poster
Rep: Reputation: 39
Yes you all are right permissions were the problem.

Last edited by tkmsr; 10-25-2010 at 08:33 AM.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Username & Password Sync Fedora Directory and Microsoft Active Directory karnac01 Fedora 4 07-19-2010 12:51 AM
change default vsftp anonymous accout directory /var/ftp to other directory? hocheetiong Linux - Newbie 2 01-24-2010 06:33 PM
Setting up authorized keys Elguapo Linux - Newbie 3 09-20-2008 07:37 AM
LXer: Directory services made easy with Fedora Directory Server LXer Syndicated Linux News 0 12-08-2006 03:54 AM
ssh to different directory other than home pridefc Linux - Software 5 11-17-2006 06:12 AM

All times are GMT -5. The time now is 09:14 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration