Objective is to connect to Linux server from jumphost using python paramiko/jumpssh, then perform some operations. From jumphost to other linux hosts, need to connect using Passwordless authentication.Please find the code below.
from jumpssh import SSHSession
# establish ssh connection between your local machine and the jump server
gateway_session = SSHSession('10.1.2.3','user1',
password='pwd123').open()
# from jump server, establish connection with a remote server
# Since it's a passwordless authentication, I'm providing password=None.
remote_session = gateway_session.get_remote_session('10.4.5.6','user1',password=None)
print(gateway_session.get_cmd_output('echo "test" && hostname '))
print(remote_session.get_cmd_output('sudo yum check-update'))
exit()
Output -
No authentication methods available
Please help me to get it through!!!