Issue
I'm trying to log into my-server
through a jump server, jump.example.com
.
I can successfully log into the jump server without a password request:
class="lang-sh prettyprint-override">ssh -i .ssh/id_rsa [email protected]
But if I use
ssh -i .ssh/id_rsa -o ProxyCommand="ssh -W %h:%p [email protected]" user@my-server
# or
ssh -i .ssh/id_rsa -J [email protected] user@my-server
I'm prompted for a password for [email protected]
.
I would not be surprised if I would prompted for a password for user@my-server
instead.
How can I specify an identity file for the jump server?
Solution
I would suggest to add the following to your ssh config
Host my_server
Hostname my-server
ProxyCommand ssh -W %h:%p jump_server
User user
IdentityFile path/to/ssh/identity/file
Port 22
Host jump_server
Hostname jump.example.com
User user
IdentityFile path/to/ssh/identity/file
Port 22
Finally to connect to your target server use
ssh my_server
Answered By - Tolis Gerodimos Answer Checked By - Senaida (WPSolving Volunteer)