2,681 questions
0
votes
0
answers
10
views
Python Paramiko method paramiko.client.SSHClient.connect only receives files via key_filename, is there a way to pass a string variable? [duplicate]
Python's package Paramiko has the moehtod paramiko.client.SSHClient.connect to connect. It receives the private key as a file with the parameter key_filename.
ssh.connect(key_filename=key_filename)
...
1
vote
1
answer
45
views
Python, SSH Tunnel forwarding with CA key
I had a working SSH tunnelforwarder using sshtunnel library.
ssh_tunnel_server = {
'ssh_address_or_host': (remote_host, 22),
'ssh_username': ssh_user,
'ssh_pkey': ssh_key_path,
'...
0
votes
1
answer
140
views
SFTP server in Python with Paramiko does not allow SFTP connections
I rewrote the question because it didn't fit underneath.
I'm trying paramiko library, in python, to configure an SFTP Server.
I start defining a ROOT_FOLDER to the path of my wished one.
Then i exend ...
0
votes
1
answer
43
views
Second .connect with paramiko (ssh) [duplicate]
Form the main Linux OS (connected, working) I would like to run another ".connect".
Here is the code:
import paramiko
hostname = "hostaname"
ip = "1111.111.11.11"
...
0
votes
1
answer
84
views
How to properly use of Python Paramiko channels to read data from it [duplicate]
This is in relation to my previous question:
Python SSH Paramiko set_keepalive not working on Linux
I'm trying to write a code that uses Paramiko's channel to execute a command on CISCO network device ...
0
votes
1
answer
103
views
Old SFTP Issue: paramiko.ssh_exception.SSHException: Incompatible ssh peer (no acceptable host key)
Error:
paramiko.ssh_exception.SSHException: Incompatible ssh peer (no acceptable host key)
Paramiko Version: 2.8.1 [cannot update unfortunately]
Debug Logs:
DEBUG:paramiko.transport:starting thread (...
0
votes
1
answer
80
views
Python SSH Paramiko set_keepalive not working on Linux
I'm trying to write a script that initializes firmware upgrade of the network switch and analyzes the output from the switch once SSH session is terminated.
I use Python 3.11 an Paramiko 3.4.0.
To ...
0
votes
1
answer
66
views
"TypeError: string argument without an encoding" when retrieving an ORM object
I'm trying to set up an SFTP server in python, using paramiko library.
I'm using a PostgreSQL to store users credentials, by SQLAlchemy library.
When I try to login using FileZilla or WinSCP to the ...
0
votes
0
answers
23
views
mock paramiko.SSHClient.exec_command() with side_effects [duplicate]
I need mock execution of some remote command via ssh.exec_command() It returns tuple (stdin, stdout, stderr) as paramiko.ChanelFile object.
I know I can use mock.MagicMock() and that is what I have ...
0
votes
0
answers
27
views
Socketio emit doesn't work inside a thread
The title. I have this code with Paramiko and Flask Socket.io and the thread is not emitting the message:
from flask import Flask, render_template
from flask_socketio import SocketIO, send
import ...
-1
votes
1
answer
78
views
Sftp paramiko and sshd-mina not able to write on remote server even if no error. On local sftp server it works though
I'm just showing the code used to try to upload a file in sftp:
# Check file size
def check_file_size(path):
try:
size = os.path.getsize(path)
print(f"Local file size: {size} ...
0
votes
0
answers
42
views
configure django storages with sftp server , docker local project
I was trying to configure django-storages to use sftp server to upload static and media to the sftp, however when I do collectstatic it shows "timeout" error
here is my django conf.
USE_NNUH ...
0
votes
1
answer
77
views
Convert paramiko.sftp_file.SFTPFile object to unicode
What I need, is to copy a .csv file from an SFTP server to a Google Cloud Storage bucket without downloading the file locally.
Here is my code so far:
from google.cloud import storage
import io
...
-1
votes
1
answer
63
views
Paramiko - How to read SSH server output of a script ran at logon
I am writing a script to do some automation and searching through the Paramiko documentation and Stackoverflow I cannot find a way to do this.
When logging in to the server in question, the server ...
0
votes
0
answers
131
views
How can I do Tailscale authentication with Paramiko?
I'm writing a script that uses the Tailscale API to get a list of devices, then uses Paramiko to connect via SSH and query some data on the device. This worked fine yesterday, but today all the ...
1
vote
1
answer
42
views
Is there a way to make two pings in one SSH session?
I'm trying to make a script that makes a connection via ssh to a cisco switch, and right there makes two pings one after the other.
The problem is when I'm doing it - the output in the second ping is &...
0
votes
0
answers
25
views
Execute Shell command after Switching to another user in Python [duplicate]
I am looking for a solution in which I should be able to do following in Python:
Login to a unix system with a generic user (user id/password);
Switch to another user who can not be directly logged ...
0
votes
0
answers
19
views
Paramiko - SFTP server removes files before they are uploaded [duplicate]
I am using paramiko to send pdf and csv files to an sftp server.
The client is telling me that some files arrive on the server but I keep getting the error:
Failed to upload 180.pdf for order 180: [...
0
votes
0
answers
77
views
Pytest/Unittest SFTP Client Connection
I've written a function that establishes and returns an SFTP client connection. Here is the code:
import paramiko
from io import StringIO
from fastapi import HTTPException
def get_sftp_client(
...
0
votes
2
answers
419
views
Can't connect to Oracle 19c db with SSH tunnel using python
I am not an expert neither on Oracle or Python, so maybe the answer is obvious but I still couldn't find the answer to my problem on forums.
I have an SSH connection to Oracle 19c db on SQL developer ...
0
votes
1
answer
73
views
Running Custom C over ssh with paramiko [duplicate]
I've been trying to automatically execute some compiled C code over an SSH session. However, I have a big issue; my C code requires user input, and therefore I need to be able to catch those inputs ...
0
votes
0
answers
96
views
Running Powershell commands using Paramiko in python in a remote Windows 7
I'm using paramiko in Python to send commands (and retrieve data) from another server.
When I send a Powershell command to Windows 10 server it all works OK.
But when sending this to Windows 7 it ...
1
vote
1
answer
91
views
Python not catching a Paramiko IncompatiblePeer exception
I have the following code:
#!/usr/bin/env python3
import paramiko
from paramiko import SSHClient
from paramiko.ssh_exception import IncompatiblePeer
xkey = paramiko.RSAKey.from_private_key_file('./...
0
votes
0
answers
18
views
Install kerberos packages using paramiko [duplicate]
I'm trying to automate installation of kerberos packages (krb5-kdc, krb5-admin-server, krb5-user) using python-paramiko library on Ubuntu server.
Ref article: https://www.atlantic.net/dedicated-server-...
0
votes
0
answers
57
views
Trouble moving directory with paramiko [duplicate]
I am trying to creating an automated process that retrieves a file/files from an API, downloads the files onto a local path, then moves the files to a remote path onto an SFTP.
API ---> Local Path--...
0
votes
1
answer
88
views
Parse the output of a linux command
I'm trying to match one specific line to capture an address in the output of a bridge control command on a remote host. I'm not sure if this should be done using stdout and readlines. I'm a noob...
...
0
votes
0
answers
32
views
Paramiko: stdin.write works only if I stop at a breakpoint, doesn't work with sleep
I'm trying to run a command on a remote Linux machine with paramiko
ssh = SSHClient()
ssh.set_missing_host_key_policy(AutoAddPolicy())
ssh.connect(IP_VM_AIX, PORT_VM_AIX, username=...
0
votes
0
answers
39
views
Breaking up python computation to speed up ssh
I'm using a Paramiko connection to execute a handful of commands over ssh. A few (not entirely real) examples to show the idea:
def get_version(conn):
stdin, stdout, stderr = conn.exec_command('...
0
votes
1
answer
243
views
Paramiko how to check if current path is directory [duplicate]
I'm encountering an issue while working with the paramiko library, specifically regarding the SFTPClient module. I'm attempting to recursively download files from a directory, including all ...
0
votes
0
answers
117
views
SFTP file transfer time stamp
I am writing a python script to check how long the file is staying in the SFTP. Every minute the script will run and it'll check if the file is there or not.
Here's a part of the script checking the ...
0
votes
1
answer
86
views
Failing to pass a downloaded file-like object from sharepoint using the shareplum and paramiko libraries
I'm receiving an error when passing a file object using paramiko's putfo().
AttributeError: 'bytes' object has no attribute 'read'
Here's what my putfo() looks like
ssh_client = paramiko.SSHClient()
...
0
votes
1
answer
224
views
How to resolve BadHostKeyException with paramiko? [duplicate]
I have following code to connect to a linux box and run a command, But I'm facing
BadHostKeyException even after I have added WarningPolicy and AutoAddPolicy.
print("---CCCCCCCCCCCCC--...
-2
votes
1
answer
37
views
How to enter a command twice with paramiko
I use paramiko package in python, and I have to input command('pcoip-list-licese') and input password('Password1!').
When in 192.168.3.1 server same command, the 192.168.3.1 server request password.
...
0
votes
1
answer
109
views
Paramiko hangs during connect()
I'm trying to use paramiko to upload files to a remote EC2 server.
My app.py which primarily handles my tkinter GUI imports a custom lib.file_handler module that handles some functionality. That ...
1
vote
1
answer
392
views
How to use pysftp with the -o"HostKeyAlgorithms=+ssh-rsa" -o"PubkeyAcceptedKeyTypes=+ssh-rsa" options?
Using paramiko I want to select the list of pubkey algorithm my key is in, do you know how I can run a similar command like:
sftp \
-i private_key.pem \
-P 22 \
-o"HostKeyAlgorithms=+...
0
votes
0
answers
36
views
how to solve the problem of the script freezing after restarting the service in paramiko python
Simple script:
import json
import paramiko
from rich import print, pretty, inspect
from settings import domain
pretty.install()
convert_dom = json.dumps(domain)
set_domain = json.loads(convert_dom)
ip ...
0
votes
0
answers
155
views
When using the Paramiko rename function to change the name of a file in a new directory I get an error
Currently, I am using Paramiko to connect to an Sftp server to find a file and then rename the file in a new directory. I can use sftp.get() to get the file and place it in my directory, however, when ...
0
votes
0
answers
71
views
Automating CLI with paramiko in python : Sending keyboard keys into CLI command [duplicate]
I am currently automating CLI command testing with paramiko in python. After successfull connection with ssh and running one command, an interactive session opens up in CLI itself, which is asking to ...
0
votes
1
answer
144
views
Get the credentials an instance of `Channel` used to authenticate in Paramiko
I've been working with this multi-threaded SSH server that I made and I've encountered an issue. I need a way to get the credentials each channel used for authentication. For example, in handle after ...
0
votes
0
answers
145
views
What is the best way to implement multithreaded SSH logins using Netmiko with Python?
I have a list of network devices I need to SSH into in order to get the output of a command. I'm using Netmiko (Python). The SSH login credentials of each "login request" are JSON objects ...
0
votes
1
answer
105
views
Paramiko Put - Send SFTP succeed but I got an error message [duplicate]
I am sending a file through a SFTP server which is known to be difficult (PORT: 1002_)
The file is going through but I still have the error
ssh_Client = pmiko.SSHClient()
ssh_Client....
0
votes
1
answer
286
views
How to open a GUI-Application on a Server (Raspi) via SSH using python/paramiko?
As server I got a Raspberry Pi with a display connected by hdmi. From my Windows 10 pc I whant to execute a gui-application on my Pi by ssh, so that the application get's displayed on the Pi's display....
0
votes
1
answer
237
views
Aws Airflow 2.7.2 installing paramiko 3.3.1 error
I'm upgrading my airflow from 1.10.12 to 2.7.2, python 3.6 to 3.11.7 and trying to install my libraries I get an error on Paramiko
enter image description here
but I have already tried to install ...
1
vote
1
answer
164
views
Paramiko "UnicodeDecodeError" when authenticating with key from Pageant
Experiencing an issue when attempting to connect to a server using Paramiko and SSH agent Pageant. The error indicates that the script is failing during the connection attempt, specifically when ...
-1
votes
1
answer
153
views
Ansible module succeeds on my Mac, but fails on a Rock Linux box?
I created an Ansible module shown on this post Pass/fail result for Paramiko SFTPClient get() and put() functions? Here's a simple playbook to test the module.
- hosts: localhost
tasks:
- name: ...
2
votes
1
answer
66
views
Pass/fail result for Paramiko SFTPClient get() and put() functions?
I'm writing an Ansible module using Paramiko's SFTPClient class. I have the following code snippets
import paramiko
from ansible.module_utils.basic import *
def get_sftp_client(host, port, user, ...
1
vote
0
answers
57
views
Paramiko on OpenWRT 22.03
I seem to be having trouble getting Paramiko to run despite all the dependencies I think it needs installed. Whenever I try to import it the following traceback occurs:
Python 3.10.9 (main, Sep 11 ...
0
votes
0
answers
41
views
Ansible custom library for SFTP returns error
I'm trying to create my first Ansible library to upload/download files from our SFTP server since the current modules do NOT support SFTP protocols. Here's the library/sftp.py file (I removed the ...
1
vote
1
answer
89
views
how to get more info from try/except
I'm having problems with my code in python where basically I make several SSH connection.
I'm always using this format:
try:
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko....
0
votes
1
answer
123
views
Why this exception using Paramiko?
I'm trying to teach myself Python to connect to an SFTP server. I tried out this sample code from How do I change directories using Paramiko?.
import paramiko
# Create an SSH client
ssh = paramiko....