When I am using the Terminal with:
ssh user@ip-adress
and enter my password
ssh-password
then everything works fine and a connection gets established which I can close with exit.
But when I am trying to do that in Python:
import sshtunnel
from sshtunnel import SSHTunnelForwarder
sshtunnel.SSH_TIMEOUT = 5.0
sshtunnel.TUNNEL_TIMEOUT = 5.0
server = SSHTunnelForwarder(
'ip-adress', 22,
ssh_username="user",
ssh_password="ssh-password",
remote_bind_address=('127.0.0.1', 3306)
)
server.start()
print(server.local_bind_port)
I'll receive an error like:
sshtunnel.BaseSSHTunnelForwarderError: Could not establish session to SSH gateway
Why?
-v, --verbose Increase output verbosity (default: ERROR)