2,686
questions
0
votes
0
answers
14
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
0
answers
23
views
Jump next value in for loop
I have a question. This is my code and I need to reset loop and continue next value of for:
from paramiko.client import SSHClient, AutoAddPolicy, RejectPolicy
...
for i in range(0, device) :
...
...
0
votes
0
answers
21
views
paramiko expected and timeout [closed]
Why does Python Paramiko wait for the timeout period even though the expected data is received? What should I do to avoid waiting for the timeout period when the expected data is received?
...
-1
votes
0
answers
38
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
24
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
53
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
49
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
72
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
22
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
53
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
261
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
70
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
71
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
71
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
51
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
85
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
31
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
38
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
137
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
90
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
69
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
158
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
35
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
71
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
246
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
33
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
111
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
70
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
128
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
116
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
87
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
223
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
209
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
134
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
131
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
59
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, ...
0
votes
0
answers
41
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
38
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
77
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
106
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....
0
votes
0
answers
47
views
Passing yubikey pin to windows
I am using WSL to run python/paramiko scripts. On the windows side, I use pageant for key management with a yubikey. From the same WSL window, when I run standard SSH, I'm only prompted once for the ...
1
vote
1
answer
150
views
How reboot remote machine via ssh avoiding timeout?
I have this part of code where I am trying to reboot a remote machine over ssh :
def check_and_reboot(ssh, hostname):
# if not ssh_connect(ssh, hostname):
# print("SSH failed, ...
0
votes
0
answers
88
views
Python Paramiko - problems with sending "iperf -s" to Linux server
I need to send the command iperf -s to a Linux server using a Python program. The command is not sent. The chronology of problems is as follows:
I am sending the command iperf -s to the server. ...
1
vote
1
answer
424
views
Get file's creation timestamp using Paramiko SFTP
Any idea if there is actually a way to get "ctime", a file's created timestamp from a SFTP server? Using Paramiko for SFTP, I am only seeing "atime" and "mtime". ...
4
votes
1
answer
154
views
How to disable load_ssh_configs in fabric (used as library) from user code?
I'm using fabric as a library and want to avoid loading my local ~/.ssh/config file (etc).
Fabrics configuration docs declare: "To do so, simply set the top level config option load_ssh_configs ...
0
votes
0
answers
70
views
Pyinfra stuck when running aws cli commands
I am cleaning up AWS s3 bucket files using pyinfra. But when i execute aws cli command in pyinfra it stuck ,it shows no response even if i give maximum verbosity -vvv
def remove_s3():
s3_buckets = ...
0
votes
2
answers
778
views
paramiko issue with host keys - BadHostKeyException [duplicate]
Here is the script that I am using to connect to an SFTP server. sftp.pem and host.pem are private keys in OpenSSH format. I created the user and added the host key to the server myself.
I keep ...