View Full Version : Ssh Key Problem
fahadsaeed
2005-06-29, 03:15 AM CDT
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
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 :confused:
fsck
2005-06-29, 03:21 AM CDT
Helllo,
(snip by fsck)
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 :confused:
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:
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.
fahadsaeed
2005-06-29, 03:01 PM CDT
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.
kg4cbk
2005-06-29, 04:52 PM CDT
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.
fahadsaeed
2005-06-29, 07:31 PM CDT
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 !!!
fsck
2005-06-30, 03:20 PM CDT
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:
cat filename > /somewhere/newfilename
then "newfilename" will be overwritten with the content of "filename", however if you do:
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.
fahadsaeed
2005-07-01, 10:07 PM CDT
thankyou
I got the problem solved
There seems to something wrong when i did this for the first client
cat ~/copy-of-authorized_keys2 >~/.ssh/authorized_keys2
Therfore i used this for the first client
cp ~/copy-of-authorized_keys2 ~/.ssh/authorized_keys2
and
used
cat ~/copy-of-authorized_keys2 >>~/.ssh/authorized_keys2
for the subsequent clients
Thanks again
vBulletin® v3.7.3, Copyright ©2000-2008, Jelsoft Enterprises Ltd.