Shutting Down SSH Tunnel in Paramiko Programmatically

We are attempting to use the paramiko module for creating SSH tunnels on demand to arbitrary servers for purposes of querying remote databases. We attempted to use the forward.py demo that ships...

Paramiko SSH Tunnel Shutdown Issue

I'm working on a python script to query a few remote databases over an established ssh tunnel every so often. I'm fairly familiar with the paramiko library, so that was my choice of route. I'd...

How to create a SSH tunnel using Python and Paramiko?

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.

Python - SSH Tunnel Setup and MySQL DB Access

I am trying to connect to my server from my local(windows) and access the MySQL DB With the below code setting up the SSH tunnel through putty, I am not able to access the MySQL DB. con =...

How to securely maintain a persistent SSH connection in PHP?

I am currently working on a VPS panel that uses a master-slave model. One master server runs a panel written in PHP, and manages multiple slave servers via SSH. The slave servers are accessed via...

Connecting to remote PostgreSQL database over SSH tunnel using Python

I have a problem with connecting to a remote database using SSH tunnel (now I'm trying with Paramiko). Here is my code: #!/usr/bin/env python3 import psycopg2 import paramiko import time #ssh =...

Connect remote server to spyder for running Python Code

Here is what I am trying to do. I have a Windows VM and another Linux VM which is used as server. I have Spyder installed on my Windows VM and would like to run my Python code in Spyder on remote...

Cant find module Django while deploying on Elastic Beanstalk

I am trying to deploy the backend of this repository https://github.com/LaunchKit/LaunchKit on Elastic Beanstalk. I am very new to Django and I successfully did those two tutorials explaining how...

SSH tunnel forwarding with jump host and remote database

I have a remote MySQL database hosted on Amazon RDS ("D"). For security purposes, it is only accessible through a remote server ("C"). C is accessible via ssh through a jump host "B". I need a...

Python: Automatically reconnect ssh tunnel after remote server gone down

I have implemented a function to establish an ssh-tunnel in Python, so I can insert data in a DB behind a NAT (no port forwarding available). import paramiko from sshtunnel import...

Paramiko exec_command with multiple commands on Cisco router not providing any output

login_user = 'xyz' login_pass = 'xyz' ssh = paramiko.SSHClient() ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) ssh.connect(device, username=login_user, password=login_pass,...

python3 pexpect strange behaviour

I have a single threaded program that simply executes commands over ssh and simply looks for output over ssh. But after a while I start getting extrodinarily strange behaviour: ssh_cmd = 'ssh...

ssl handshake failure using proxy for scrapy

I'm trying to setup a proxy on a scrapy project. I followed te instructions from this answer: "1-Create a new file called “middlewares.py” and save it in your scrapy project and add the...

Parallel threads/telnet with Python: can't use len(list) > 1000

I have a program that will receive a list holding the IP addresses of routers. For each of those, a telnet connection will be triggered over an SSH tunnel. This is working nice. Except for the...

"base64 decoding error: Incorrect padding" when loading PuTTY/ppk private key to Paramiko

I am attempting to create an SSH tunnel using paramiko and SSHTunnelForwarder using Python 3.6 on Windows 10 I already have a connection setup with PuTTY and it connects without issue.. Whenever I...

Pgadmin4: Error module 'paramiko' has no attribute 'Ed25519Key'

This only happens when you attempt to connect to a database with pgadmin using ssh tunneling. The most up-to-date version of paramiko and pgadmin4 in the ubuntu 18.04 repositories will not fix the issue.

libssl issue using paramiko and sshtunnel with docker alpine

I have been struggling with some process for while now and I decided to come shout for help. I have a script that suppose to download some file and drop it inside some sftp server for batch...

Python SSH iteration through different paths

I've got a JSON object which looks like this: {UID_1:{ jumpboxes:[jump_ip1, jump_ip2,...], hosts: [host_ip1, host_ip2,...], ...}, UID_2:{... The authentication to the jumpboxes is via...

Paramiko or sshtunnel and ssh-agent without entering passphrase

I am trying to create a tunnel to a server with sshtunnel. I am using an ssh-key and ssh-agent: from sshtunnel import SSHTunnelForwarder with SSHTunnelForwarder( (proxyhost, 22), ...

Problem closing a ssh tunnel in python 3 but not in python 2

Good morning. I'm trying to read a SQL query with pandas through a SSH tunnel. It worked fine in python 2.7, but now, with python 3.7, it seems like the process paused when trying to close the...

Translate Oracle SQL Developer SSH Host w/ Local Port Forward Connection to Python

I'm trying to create a Python connection to a remote server through an SSH Jump Host (one I've successfully created in Oracle SQL Developer) but can't replicate in Python. Can connect to SSH Host...

Attempting to do remote login over SSH connection using python script

I am trying to log in to a remote server after setting up an SSH connection. I can get the SSH Tunnel to work, but from there I'm stumped on how to log in. I am currently using Python's sshtunnel...

scapy sniff using remote host's interface

I want to sniff some packets using scapy, but not from the interface of own host, but want to sniff from a remote host (e.g. 192.168.1.x) and its interface. is this possible with python and scapy...

how can i connect (ssh remote) mongodb with python instead of terminal macos?

I want to connect MongoDB server with python. I have connected it on the terminal of MacOS and I run some MongoDB queries. (as described this link http://ghtorrent.org/raw.html) sshtunnel: ssh -L...

Launching Docker containers with arguments using Python3

I have a Python3 application launching inside a Docker container; and when the Docker container is launched, it accepts arguments that are passed to the Python3 application. Pretty straight...

How to use Python SSHTunnle to forward multiple ports

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 ->...

Spyder isn't opening after update

I updated my Spyder to version 4.0.1 then this happens: (base) C:\Users\Mehdi_2>conda run spyder Traceback (most recent call last): File...

Tunneling not working using paramiko My machine > RDP to VM machine > network device via SSH

Can you please assist. I am doing some channeling from my windows machine via python. I could not get into the remote desktop. I am using ssh, but I know this seems to be wrong. This is working to...

How to set up connection to AWS rds via ssh to server from python?

I have to access an aws rds from a remote server. So far I have had no problems accessing the mysql databases from the command line. I ssh to the server like: ssh [email protected] Once I'm...

upload files using sftp with proxy(http) using python-paramiko

I am new to python paramiko. I am trying to upload files in my client server with sftp using python-paramiko. I have code without proxy setup. Please find that below. host = "abc.mno.com" port =...