1753974 Members
7729 Online
108811 Solutions
New Discussion юеВ

Re: ssh to host

 
SOLVED
Go to solution
ust3
Regular Advisor

ssh to host

I have three hosts ( host A , B & C ) , host A can ssh host C without password , now I would like host B can also ssh to host C , if I just overwrite the id_rsa.pub from host B to host C' ~user/.ssh/authorized_keys file , then I think host A will no longer can ssh to host C , can advise if I want BOTH A & B can ssh to host C without password , what can I do ? thx
2 REPLIES 2
Ivan Ferreira
Honored Contributor
Solution

Re: ssh to host

You need to append the hostB key to authorized_keys, for example:

hostB# scp id_rsa.pub hostC:/tmp

hostC# cat /tmp/id_rsa.pub >> authorized_keys
Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?
skt_skt
Honored Contributor

Re: ssh to host

see a below example with H1, H2 and H3 for f
H1

Login with "applmgr" account and check if you have these files -
/home/applmgr/.ssh/id_rsa
/home/applmgr/.ssh/id_rsa.pub

If not then run;

ssh-keygen -t rsa

example -

$ uname -a
HP-UX H1 B.11.11 U 9000/800 2339995041 unlimited-user license

$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/sharma/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/sharma/.ssh/id_rsa.
Your public key has been saved in /home/sharma/.ssh/id_rsa.pub.
The key fingerprint is:
c1:a8:1d:f8:e5:a4:79:10:d3:5c:d8:90:72:0d:f0:84 sharma@H1




Now copy the contents of H1 "/home/applmgr/.ssh/id_rsa.pub" to H2 "/home/applmgr/.ssh/authorized_keys". Append in case the authorized file already exists on H2.

Repeat the same ssh-keygen process for H3 and then append the H3 "/home/applmgr/.ssh/id_rsa.pub" to H2 "/home/applmgr/.ssh/authorized_keys". Once done, H2 should allow passwordless ssh for applmgr account from H3 and H1 both.

P.S - The public/private key pair needs to be generated only once via ssh-keygen and thereafter same keys can be copied to "authorized_keys" on diff. servers for passwordless entry.