ssh between 2 machine without password

Michael Velez mikev777 at hotmail.com
Sat Mar 5 22:33:09 UTC 2005


> >> -----Original Message-----
> >> From: redhat-list-bounces at redhat.com
> >> [mailto:redhat-list-bounces at redhat.com] On Behalf Of Rushan Sobar
> >> Sent: Saturday, March 05, 2005 7:35 AM
> >> To: General Red Hat Linux discussion list
> >> Subject: ssh between 2 machine without password
> >>
> >> Hi,
> >> on the following steps
> >>
> >> to generate a public/private DSA key pair on Ooga.
> >>   ooga% ssh-keygen -t dsa -f ~/.ssh/id_dsa
> >>
> >> When you are asked for a passphrase, leave it empty. Now send
> >> the public key to Booga.
> >>
> >>   ooga% cd .ssh
> >>   ooga% scp id_dsa.pub user at booga:~/.ssh
> >>
> >> Next, log in to Booga and add the public key to the list of
> >> authorized keys.
> >>
> >>   ooga% ssh user at booga
> >>
> >>   booga% cd .ssh
> >>   booga% cat id_dsa.pub >> authorized_keys2
> >>   booga% chmod 640 authorized_keys2
> >>   booga% rm -f id_dsa.pub
> >>
> >> the filename is authorized_keys2, not authorized_keys. That's
> >> it; now ready to ssh from Ooga to Booga without having to
> >> enter a password.
> >>
> >> what if i want to be able to ssh from Booga to Oooga without
> >> having to enter a password?
> >>
> >> i mean the steps up enable to connect from Ooga to Booga
> >> without pass but from Booga to Ooga it ask for pass, i want 2
> >> way without pass!!
> >>
> >> Anyhelp?
> >> redhat-list mailing list
> >> unsubscribe mailto:redhat-list-request at redhat.com?subject=subscribe
> >> https://www.redhat.com/mailman/listinfo/redhat-list
> >>
> >
> > You need to do the same process you did before by inverting 
> the commands 
> > you
> > do on ooga and booga.  That is, generate a dsa key on booga 
> then take the
> > new id_dsa.pub that has been generated on booga and put it into the
> > authorized_keys (or authorized_keys2 depending on your 
> config file) on 
> > ooga.
> > Same process but mirrored.
> >
> > It's best to generate one key per direction, as opposed to 
> just using the
> > previously generated key.
> >
> > Michael
> 
> Yes but what happen when I reverse and mirror the steps , 
> booga connect to 
> Ooga without passwd and the 1st Ooga to Booga start asking for 
> passwd.everytime I reverse the command it start connect 
> without passwd and 
> the 1st start asking for password....
> 
> Regards
> -- 
> redhat-list mailing list
> unsubscribe mailto:redhat-list-request at redhat.com?subject=unsubscribe
> https://www.redhat.com/mailman/listinfo/redhat-list
> 

Rushan,

Do all the following steps 1 after the other and the process will work:

 	ooga% ssh-keygen -t dsa -f ~/.ssh/id_dsa
 	ooga% mv id_dsa.pub ooga_id_dsa.pub
 	ooga% scp ooga_id_dsa.pub user at booga:~/.ssh
	ooga% ssh user at booga

	booga% cd .ssh
	booga% cat ooga_id_dsa.pub >> authorized_keys2
	booga% chmod 640 authorized_keys2
	booga% ssh-keygen -t dsa -f id_dsa
	booga% mv id_dsa.pub booga_id_dsa.pub
	booga% exit

	ooga% cd ~/.ssh
	ooga% scp user at booga:~/.ssh/booga_id_dsa.pub ~/.ssh
	ooga% cat booga_id_dsa.pub >> authorized_keys2
	ooga% chmod 640 authorized_keys2

If you do all the steps above and generate a key on both machines without
specifying a passphrase for either key, you will be able to do what you
want.  What this does is create a unique private key for each machine and
put the corresponding public key in the other machine's authorized_keys
file.  You have generated two public/private key pairs, one on each machine.

Afterwards if you want, you can remove the public keys (booga_id_dsa.pub and
ooga_id_dsa.pub) on both ooga and booga.  You do that with the following
command:

	rm -f booga_id_dsa.pub ooga_id_dsa.pub

Execute the above command while in the ~/.ssh directory on both ooga and
booga.  I renamed the files from the default id_dsa.pub only to avoid
confusion that there are now two public key files, one for ooga and one for
booga.

Hope this clears things up,
Michael





More information about the redhat-list mailing list