LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 02-27-2008, 02:43 PM   #1
cygnus-x1
Member
 
Registered: Jul 2006
Location: Crisfield
Distribution: Slackware, CentOS, RedHat
Posts: 159

Rep: Reputation: 15
Question ssh-keygen keys question


If I have 2 machines that I need to ssh between. I wish to use a key with no passphrase.

I have generated the keys on one machine for the user. I then copied the entire set over to the other machine for the user keeping the strict permissions the same.

I can easily ssh in without being prompted from one node but not the other. The one that does work from is the one where I did NOT generate the keys.

I notice in the keys at the end there is a user@host string. Are private keys married to the machine they are generated on? I am trying to use the same set of keys on both machines is that possible?

thanks

Doug
 
Old 02-27-2008, 03:02 PM   #2
tronayne
Senior Member
 
Registered: Oct 2003
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,541

Rep: Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065
When you do the key generation, you get two files, say they're id_dsa, the private key, and id_dsa.pub, the public key (if you generated the default, they'll be id_rsa). You do not copy the id_dsa to the other machine; you only copy the id_dsa.pub file to the other machine's authorized_keys file in the .ssh directory. You do this on both machines, only copying the public key to the other's authorized_keys file.

Try that instead of what you said you did and it should work in both directions for you.

Hope this helps.
 
Old 02-27-2008, 03:26 PM   #3
cygnus-x1
Member
 
Registered: Jul 2006
Location: Crisfield
Distribution: Slackware, CentOS, RedHat
Posts: 159

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by tronayne View Post
When you do the key generation, you get two files, say they're id_dsa, the private key, and id_dsa.pub, the public key (if you generated the default, they'll be id_rsa). You do not copy the id_dsa to the other machine; you only copy the id_dsa.pub file to the other machine's authorized_keys file in the .ssh directory. You do this on both machines, only copying the public key to the other's authorized_keys file.

Try that instead of what you said you did and it should work in both directions for you.

Hope this helps.
Yes it did help. I was just trying to keep the amount of keys down for some reason. I did not realize that keys were only good for one way connections between hosts.

Just for knowledge sake couldn't you also generate the keys on box1, then copy the private to box2, then ssh back to box1 with the ssh -i .ssh/id_rsa ..... ?

thanks
 
Old 02-27-2008, 03:39 PM   #4
tronayne
Senior Member
 
Registered: Oct 2003
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,541

Rep: Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065
Without going on a document hunt, I seem to recall that ssh-keygen is machine-dependent; it uses values from the installation. Could be wrong about that, but that tickles my memory. So, nope, can't just go copying the same files all over the place and have it work (as you noticed?). And, think about it, wouldn't you want a machine to have its own public and private key pair?
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
ssh-agent, ssh-add and ssh-keygen AND CVS raylpc Linux - General 2 11-19-2008 02:50 AM
need help automating ssh-keygen linxq4u Linux - General 1 08-25-2007 11:13 AM
How to ssh-keygen? Baran Linux - Networking 5 04-26-2005 02:40 PM
ssh-keygen problem mijohnst Linux - Networking 5 07-20-2004 01:00 PM
sftp and ssh-keygen help please grayhost Linux - Newbie 2 06-26-2003 05:51 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

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

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