Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Unable to SSH

Status
Not open for further replies.

Sreekanth1521

Programmer
May 21, 2020
2
IN
Hi

Below is my setup.

MACHINE A --------------------> MACHINE B --------------------> MACHINE C

I want to ssh Machine C from Machine A.

I tried this with the below command, but failed.
$ sshpass -p 'PassWordB' ssh -p 2222 -tt admin@<ip - B> sshpass -p 'PassWordC' ssh admin@< 172.16.1.21>

Any how if I do hop by hop its happening, means
1. sshpass -p 'PassWordB' ssh -p 2222 -tt admin@<ip -B>
THIS TAKES ME TO MACHINE B FROM MACHINE A

2. MACHINE-B:~$ ssh admin@172.16.1.21
The authenticity of host '172.16.1.21 (172.16.1.21)' can't be established.
ED25519 key fingerprint is 33:8:aa:ff:kf:ee:22:77:55:44:55:44:cc:77:55:33.
Are you sure you want to continue connecting (yes/no)? yes
Failed to add the host to the list of known hosts (/home/admin/.ssh/known_hosts).
admin@172.16.1.21's password:
Permission denied, please try again.
admin@172.16.1.21's password:
Permission denied, please try again.
admin@172.16.1.21's password:
Machine-C:~$

I am trying to ssh to Machine C from shell script.
Please help.
-Regards,
Sreekanth
 
Hello Sreekanth,

Why not use something like ssh jumphost command like so:

ssh -i {keypath} -o ProxyCommand="ssh -i {keypath} -W %h:%p user@{jumphost}" user@{hiddenhost}

where:
• jumphost is IP of your publicly accessible instance,
• hiddenhost is IP of your host in the private network,
keypath is a path to your private key located on the current machine that you are trying to ssh from

It is more secure and easier to use ssh key rather than password
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top