Fedora Linux Support Community & Resources Center
  #1  
Old 29th June 2005, 10:15 AM
fahadsaeed
Guest
 
Posts: n/a
Unhappy Ssh Key Problem

Helllo,

I am trrying to use ssh using the key method.
I used an hoiw to and it was working fine till now and i dont know what is wrong
Please help me
i have a remote system 192.168.0.9 and it has an accout named admin
after logging in as admin in my local machine i do this

HTML Code:
ssh-keygen -t rsa
ssh admin@192.168.0.9 "mkdir -p .ssh;chmod 0700 .ssh"
scp .ssh/id_rsa.pub admin@192.168.0.9:/tmp
ssh admin@192.168.0.9 "cat /tmp >>/home/admin/.ssh/authorized_keys2

PLease help
Reply With Quote
  #2  
Old 29th June 2005, 10:21 AM
fsck Offline
Registered User
 
Join Date: May 2005
Location: London, UK
Posts: 704
Quote:
Originally Posted by fahadsaeed
Helllo,
(snip by fsck)
HTML Code:
ssh-keygen -t rsa
ssh admin@192.168.0.9 "mkdir -p .ssh;chmod 0700 .ssh"
scp .ssh/id_rsa.pub admin@192.168.0.9:/tmp
ssh admin@192.168.0.9 "cat /tmp >>/home/admin/.ssh/authorized_keys2
PLease help
EDIT:
Sorry, let me be clearer.
If you have run "cat /tmp >> authorized_keys2", then your authorized_keys2 file may well be corrupted, and any additional keys added to it may not be recognised.
If you ONLY want to use the key you are now copying for authorisation, then run the commands again but change the last line to read:
Code:
ssh admin@192.168.0.9 "cat /tmp/id_rsa.pub >/home/admin/.ssh/authorized_keys2
(Note! There is only 1 ">" in that command, it will overwrite the authorized_keys file)
If there are keys in the existing file which need to be saved, you should copy the file to one side to make a backup, then edit authorized_keys2 to leave only the keys in the file, and not the corruption.

Also, ensure that your "identity" key in the local .ssh directory is set correctly, or use the "-i" option to ssh.

C.
__________________
Want to get better answers? Learn to ask better questions!
fukka.co.uk for spamassassin rules and random garbage.

Last edited by fsck; 29th June 2005 at 10:48 AM. Reason: clarity
Reply With Quote
  #3  
Old 29th June 2005, 10:01 PM
fahadsaeed
Guest
 
Posts: n/a
OK
I agree, it seems to be that the keys are corrupted when the above mentioned method was adopted(by me).
But i still have a problem.
I want one of my servers to be able to allow four different clients to communicate, without using passwords.
How may i do that?
Because if i adopt the method posted by fsck that the authorized_keys2 file is always overwritten and only one client must be able to communicate then.



Please HELP.
Reply With Quote
  #4  
Old 29th June 2005, 11:52 PM
kg4cbk Offline
Registered User
 
Join Date: Feb 2005
Posts: 675
You can use >> to append to the file. fsck indicated the problem, you copied the /tmp directory to the file not the actual key file.
Reply With Quote
  #5  
Old 30th June 2005, 02:31 AM
fahadsaeed
Guest
 
Posts: n/a
Hi,

I got that from fsck but the poblem is still where it was

When i use the direct method of creating authorized_keys2 with > i get the right results.I mean it would let me enter without any passwords.

But when i use indirect method of

ssh admin@192.168.0.9 "cat /tmp/id_rsa.pub >/home/admin/.ssh/authorized_keys2


it wont let me in without a password.

I checked the lines that were appended in authorized_keys2 and they were exactly the same lines as of /tmp/id_rsa.pub.(i used "diff" to confirm it ).

Please HELP ME,I am in GREAT TROUBLE........................................... .................................................. PLEASE PLEASE PLEASE !!!
Reply With Quote
  #6  
Old 30th June 2005, 10:20 PM
fsck Offline
Registered User
 
Join Date: May 2005
Location: London, UK
Posts: 704
Quote:
Originally Posted by fahadsaeed
Hi,

I got that from fsck but the poblem is still where it was

When i use the direct method of creating authorized_keys2 with > i get the right results.I mean it would let me enter without any passwords.
(snip by fsck)
Sorry, I don't understand the problem from what you describe.
Perhaps there is an issue which I can clear up.
If you do:
Code:
cat filename > /somewhere/newfilename
then "newfilename" will be overwritten with the content of "filename", however if you do:
Code:
cat filename >> /somewhere/newfilename
(Notice the 2 >) then the content of "filename" will be added to the end of "newfilename".
So. If you want to create an "authorized_keys2" file with 4 public keys in, you should use ">" the first time, and ">>" every other time.

Hope this helps.

C.
__________________
Want to get better answers? Learn to ask better questions!
fukka.co.uk for spamassassin rules and random garbage.
Reply With Quote
  #7  
Old 2nd July 2005, 05:07 AM
fahadsaeed
Guest
 
Posts: n/a
thankyou
I got the problem solved

There seems to something wrong when i did this for the first client
Quote:
cat ~/copy-of-authorized_keys2 >~/.ssh/authorized_keys2
Therfore i used this for the first client
Quote:
cp ~/copy-of-authorized_keys2 ~/.ssh/authorized_keys2
and
used

Quote:
cat ~/copy-of-authorized_keys2 >>~/.ssh/authorized_keys2

for the subsequent clients


Thanks again
Reply With Quote
Reply

Tags
key, problem, ssh

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

Forum Jump


Current GMT-time: 18:54 (Tuesday, 21-05-2013)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat