Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have 2 server systems: remoteserver1 & remoteserver2. Remoteserver2 is protected from outside login so in order for me to access it, i have to ssh into remoteserver1 and then ssh into remoteserver2. I have ssh already setup to log into remoteserver1 and it works. it doesn't ask me for a password to login. However, once i get into remoteserver1, i ssh into remoteserver2 and it will ask me for a password. So, is there anyway that i can log into remoteserver2 from remoteserver1 without the need of giving the password? Both the servers share the same home directory, so the .ssh folder is the same.

Thank you in advance.

share|improve this question
up vote 0 down vote accepted

Add the key file you use to get into the bastion host to the .ssh directory (id_rsa / id_dsa file).

I'd simply suggest creating a new pair specifically for the remoteserver1 => remoteserver2 pair. Look into ssh-keygen to create a pair for those hosts.

share|improve this answer
worked! thank you – user126043 Jun 29 '12 at 14:21

Assuming they rely on the same key pair, you can forward the ssh-agent with the -A switch, i.e.:

ssh -tA remoteserver1 ssh remoteserver2

Also see here for some neat ProxyCommand tricks.

share|improve this answer
Thank you for the command. the proxy command tricks however did not link. thank you – user126043 Jun 29 '12 at 14:21

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.