ssh-tunnel

Open SSH Tunnel with private key stored in S3

Open SSH Tunnel with private key stored in S3 Question: If I run the following code, my SSH Tunnel works perfectly. from sshtunnel import SSHTunnelForwarder tunnel = SSHTunnelForwarder( ssh_host=(SSH_JUMPHOST, SSH_PORT), ssh_username=SSH_USERNAME, ssh_pkey="/path/to/key/in/my/machine", remote_bind_address=( REMOTE_HOST, REMOTE_PORT, ), local_bind_address=("127.0.0.1", 12345), ssh_private_key_password=SSH_PKEY_PASSWORD, ) tunnel.start() # Things happen in the tunnel… However, I want to read a .pem key …

Total answers: 1

How create port forwarding using SSHtunnelForwarder?

How create port forwarding using SSHtunnelForwarder? Question: I am trying to replicate: ssh -i [KEY] -L [FROM_PORT]:localhost:[TO_PORT] ubuntu@[REMOTE_SERVER_IP] in python and decided to use sshtunnel for it. The command given above works and I can connect to the remote Theia IDE, but I can’t figure out how I need to configure SSHtunnelForwarder to achieve the …

Total answers: 1

How to send HTTP GET request from remote host using SSH connection in Python?

How to send HTTP GET request from remote host using SSH connection in Python? Question: I’m using an SSH connection with Paramiko. My code: client = paramiko.SSHClient() client.set_missing_host_key_policy(paramiko.AutoAddPolicy()) client.connect(hostname=remote_host, username=remote_user, password=remote_password, port=remote_port) How to send HTTP GET request from connected remote host (use it like a proxy)? I’ve found solution according to the answer: with …

Total answers: 1

How to use Python SSHTunnle to forward multiple ports

How to use Python SSHTunnle to forward multiple ports Question: I need to forward to multiple ports which are sits behind a server server1(22) -> Server2(mysql, 3360) = local 3360 -> Server3(http, 8080) = local 8080 -> Server4(oracle,1234) = local 1234 I can only access Server2,3, and 4 via server1. I am using Python ssltunnel …

Total answers: 2

tkinter.TclError: no display name and no $DISPLAY environment variable python

tkinter.TclError: no display name and no $DISPLAY environment variable python Question: I want to execute my python file in a remote system using ssh. I exported the file to the remote system. Here’s the sample file: import os import time import pymsgbox pymsgbox.alert(‘Hi Afreeth ‘, ‘Welcome’) if ‘DISPLAY’ not in os.environ: pass I want to …

Total answers: 2

PyCharm: Configuring multi-hop remote Interpreters via SSH

PyCharm: Configuring multi-hop remote Interpreters via SSH Question: To connect to the computer at my office I need to run ssh twice. First to connect to the host-1 and then from host-1 to host-2 and each one has different credentials. However the configuration menu in Pycharm only accepts one ssh tunnel. Configure Remote Python Interpreter …

Total answers: 3

How to connect MySQL database using Python+SQLAlchemy remotely?

How to connect MySQL database using Python+SQLAlchemy remotely? Question: I am having difficulty accessing MySQL remotely. I use SSH tunnel and want to connect the database MySQL using Python+SQLALchemy. When i use MySQL-client in my console and specify “ptotocol=TCP“, then everything is fine! I use command: mysql -h localhost —protocol=TCP -u USER -p I get …

Total answers: 5

How to create a SSH tunnel using Python and Paramiko?

How to create a SSH tunnel using Python and Paramiko? Question: I need to create tunneling to read information from a database. I use Paramiko, but I have not worked with tunneling yet. Please provide an example of a simple code that creates and closes a tunnel. Asked By: Ivan || Source Answers: I used …

Total answers: 6