LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-10-2011, 12:27 PM   #1
kidsin
Member
 
Registered: Aug 2011
Distribution: Debian 6.0.2
Posts: 31

Rep: Reputation: Disabled
Question migrating ssh keys


Hello,

I need to migrate ssh keys.
I have copied id_rsa & id_rsa.pub to .ssh & permission to 700.
Also, ran ssh-add

However i get error when i connect using ssh

Permission denied (publickey).

What i need to do to resolve this?
 
Old 08-10-2011, 12:35 PM   #2
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297
Hello,

Set permissions to 600 instead of 700 and try again. I've had similar errors with wrongly set permissions on the keys. Both on authorized_keys on the remote side as on the key locally used to connect.

Kind regards,

Eric
 
Old 08-10-2011, 12:45 PM   #3
kidsin
Member
 
Registered: Aug 2011
Distribution: Debian 6.0.2
Posts: 31

Original Poster
Rep: Reputation: Disabled
After setting it to 600, the error does not go.
 
Old 08-10-2011, 03:12 PM   #4
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297
Hello,

Can you run the ssh command a bit more verbose:
Code:
ssh -v yoursshcommand (change IP/hosts for privacy please)
Sorry for the delay, had to resolve a problem for a customer.

Kind regards,

Eric
 
Old 08-14-2011, 09:08 AM   #5
kidsin
Member
 
Registered: Aug 2011
Distribution: Debian 6.0.2
Posts: 31

Original Poster
Rep: Reputation: Disabled
Sorry, having network problems right now.
Will post the output when my network problem resolves.

Last edited by kidsin; 08-15-2011 at 01:40 AM.
 
Old 08-16-2011, 12:37 AM   #6
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297
Hi kidsin,

Any update regarding your problem?

Kind regards,

Eric
 
Old 08-16-2011, 01:40 AM   #7
kidsin
Member
 
Registered: Aug 2011
Distribution: Debian 6.0.2
Posts: 31

Original Poster
Rep: Reputation: Disabled
Sorry for the delay.

Here is the ssh -v output: https://gist.github.com/ca42c922f2111e914d76

Also, this might be useful
Code:
ls -l .ssh

-rw------- 1 kidsin kidsin id_rsa
-rw------- 1 kidsin kidsin id_rsa.keystore
-rw------- 1 kidsin kidsin id_rsa.pub
-rw------- 1 kidsin kidsin known_hosts

Last edited by kidsin; 08-16-2011 at 01:46 AM.
 
Old 08-16-2011, 01:49 AM   #8
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297
Hello,

Can you post the sshd_config file from the remote server?

Kind regards,

Eric
 
Old 08-16-2011, 01:59 AM   #9
kidsin
Member
 
Registered: Aug 2011
Distribution: Debian 6.0.2
Posts: 31

Original Poster
Rep: Reputation: Disabled
No sorry i cant. Why is that needed?
I had migrated the same ssh keys few times in the past and it was working fine. This is sudden, and mostly i am missing something crucial.

What did you think of the output? Anything amiss?

Last edited by kidsin; 08-16-2011 at 02:01 AM.
 
Old 08-16-2011, 02:05 AM   #10
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297
Hi,

To check the configuration on the remote side (server side) which seems to be rejecting your key. Is the remote server yours? Did someone by any chance delete your key from the authorized_keys file on the remote side?

Kind regards,

Eric
 
Old 08-16-2011, 02:20 AM   #11
kidsin
Member
 
Registered: Aug 2011
Distribution: Debian 6.0.2
Posts: 31

Original Poster
Rep: Reputation: Disabled
There is no problem on the remote end. The ssh key are working fine from the old OS. It is just not working on the new OS. (Both the OSes on the same PC, after migration i intend to remove the old OS)
 
Old 08-16-2011, 02:48 AM   #12
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297
Hi,

Did you compare owner and permissions between old OS and the new one? If so, where there any differences?

Kind regards,

Eric
 
Old 08-27-2011, 12:09 PM   #13
kidsin
Member
 
Registered: Aug 2011
Distribution: Debian 6.0.2
Posts: 31

Original Poster
Rep: Reputation: Disabled
Yes. i compared the permission setting there are same.
It just wont work.

Migration has stalled as Debian doesnt seem to be stable on my machine. It gets hung unpredictably.

Last edited by kidsin; 08-27-2011 at 12:15 PM.
 
  


Reply



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
How to set SSH keys on SSH server mansour Linux - Newbie 27 01-16-2011 11:44 AM
SSH host keys are not being read correctly from .ssh/known_hosts. bartonski Linux - Software 3 10-29-2009 04:40 PM
migrating sshd keys to new machine genmaicha Linux - Software 1 08-28-2009 11:21 PM
SSH host keys VS SSH keys kenneho Linux - Security 3 09-11-2008 06:03 AM
Configuring SSH to accept only keys (already have keys) fr0st Linux - Security 3 11-04-2003 03:31 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:53 PM.

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