Questions tagged [ssh]

Secure Shell - a network protocol for exchanging data throughout secure channel with most common uses of remote command execution (remote shell/console) and file transfer. Use this tag for programs and scripts using the SSH protocol, including the associated SCP and SFTP file-transfer mechanisms.

Filter by
Sorted by
Tagged with
1 vote
1 answer
83 views

Is it a correct way to read a file contents using paramiko (SSH, SFTP client)?

Is my implementation of _read_contents (3 lines) fine, or does it create a potential problem (e.g. passing part of an object that has to be destroyed, or a ...
Yulia V's user avatar
  • 633
3 votes
0 answers
463 views

Tauri/Rust small program to upload files with use of threads and openssh

First time I'm using Rust in one of my programs and I feel a lot can be improved. I don't have any colleagues / friends that already used Rust so this is the only way to get some validation that it's ...
Jeroen Claessens's user avatar
2 votes
0 answers
73 views

Transfer data from a PLC on remote server into MQTT

Newbie here. I want to write a code that can open an SSH Tunnel for a remote server, then read out the data from a PLC and transfers it in JSON format via MQTT. This is my code, but I don't think this ...
mijki's user avatar
  • 21
1 vote
0 answers
120 views

Python Local/Remote File Manager & RSync Terminal User Interface (TUI)

I have been working on a Python Curses terminal user interface for RSync for a little while now. I recently visited code review and recieved some help with cleaning up the code to make it more ...
Kriffer's user avatar
  • 43
3 votes
1 answer
114 views

Python File Explorer / RSync Terminal User Interface

I've been working on my first python program for a few weeks now and I feel like the program is at a decent stage to begin sharing. The premise was to create a file explorer that eases the use of ...
Kriffer's user avatar
  • 43
3 votes
2 answers
349 views

Bash script using SSH to sum disk usage on NetApp

I have tried to come with below bash script which is at least working for me, i know its not perfect and that why i want some review and suggestion to make it more aligned with bash practices. I'm ...
user294110's user avatar
1 vote
0 answers
34 views

Wrap an ssh2 connection neatly and pass commands

I want to structure this better but don't think I'm handling results well. I'm used to python and I think my flow is way off. Is this bad design? Should my results be Result<String, Error>? I'm ...
shaciaran's user avatar
2 votes
2 answers
103 views

Retrieve Logs from Multiple Containers on Remote Server

Recently I had the requirement to allow multiple containers of the same application to be run on a single development server. This requirement drastically changed how we retrieve logs over SSH from ...
Brendan Lesniak's user avatar
3 votes
0 answers
85 views

Bash script to mirror XWindow to remote SSH host

The source code within this question aims to provide a short-cut for mirroring a local XWindow (or session) to a remote host via SSH port forwarding, such as: ...
S0AndS0's user avatar
  • 976
1 vote
1 answer
307 views

Ruby - Sending commands to multiple servers using Net::SSH

The idea At my work, I'm tasked with retrieving logs for a list of online orders from a total of 12 servers. To do this, I SSH into them (with a jump host in between) one by one, run the script for ...
JRTN's user avatar
  • 111
1 vote
0 answers
739 views

SSH Port Forwarding - golang

I developed this small code to make my life easier when I work with remote machines over ssh tunnel crossing a bastion host. I would like to publich it so others could benefit/learn from it. So I ...
Kingindanord's user avatar
1 vote
0 answers
86 views

ssh key install

I wrote script to install public key of my system to remote host. I had tested the script it is working fine for me. script take data like IP password and ssh port form CVS file. I do not want to use ...
jay sonar's user avatar
2 votes
0 answers
43 views

Bash script to scp specific, most-recent files from remote server

I'm writing a helper script that I wish to be able to share with my co-workers. We all work using macOS Mojave, but all have their own shell configurations. For example, I actually use ZSH and bash 5....
dylanjm's user avatar
  • 225
1 vote
0 answers
868 views

Polling an SFTP server to list files in a directory

When is it better to instantiate the sftp client globally vs inside a function as shown below? What considerations favor one method over the other? For a long ...
trivial_tasks's user avatar
3 votes
1 answer
43 views

SSH autokiller for connections from other systems

I was messing around with ssh and decided to write a python program that scans for any connections that aren't from the system, then terminates them. It works well ...
Linny's user avatar
  • 9,989
3 votes
1 answer
59 views

Syncing GitHub repositories local, remote and forks

It's a simple bash script but I'm hoping for feedback, advice and examples on how to improve the script and code. Can you guide me how to put more checks in the code and more if possible? This code: ...
somethingSomething's user avatar
4 votes
1 answer
168 views

Copy files from directory to SSH Server

The overall idea is: I have an Android phone and I would like to copy the files in a folder from the phone (which is running an SSH server, that's how I connect to it) to a harddrive connected to my ...
BruceWayne's user avatar
3 votes
2 answers
67 views

Creating remote directories in a bash script via ssh (with error trapping)

I'd like to create directories on a remote VM, but only if they do not exist. What's more, if creating the directory results in an error (exit status != 0) I'd like the script to exit as well, or at ...
Server Fault's user avatar
2 votes
1 answer
5k views

Python rsync to copy the logs from multiple remote servers

I have the below code which i'm working to copy(using rsync) the contents From remote host labserver01 and dumps those into the directory ...
Karn Kumar's user avatar
1 vote
2 answers
948 views

Python functions to fetch spreadsheets through SFTP and from Dropbox [closed]

I have written two functions- first one is to read files from SFTP and second one is to read files from Dropbox. Both functions have some similar line of code like validating extension and reading/...
AnalyticsPy's user avatar
1 vote
1 answer
347 views

Sending an uptime to a remote server through SSH with the method pxssh

I have this code that I'm putting into a library script. The aim of the code is the following: The method is to connect to a remote server and run uptime on the ...
Andy K's user avatar
  • 612
8 votes
1 answer
111 views

Squire for your recursive SSH adventures

One day I used to SSH to lots of machines to do some administrative tasks. I constantly used l to list directories just like I do on my own machines. Guess what, ...
sineemore's user avatar
  • 1,785
2 votes
0 answers
453 views

SSH log in to multiple devices, save local config and transfer to backup server

I don't really know the best way to deal with long lines. The comments may be a little excessive. To me it seems like too much code for how "little" is actually done. I'm not that experienced and want ...
Lele's user avatar
  • 21
4 votes
1 answer
50 views

throwcatch: Super easy, SFTP-based backup tool

I've been working on a project for fun, it has reached a place of pretty decent stability and I would like to hear any and all criticisms you can find. The project basically enables admins to create ...
user165397's user avatar
1 vote
1 answer
86 views

BFA protected phpmyadmin

I use a Ubuntu 16.04 Nginx server environment with phpmyadmin (PMA). All my ports are closed besides 22, 25, 80, 443, 9000 (for PHP-FPM). A common criticism of the good software (PMA) as of 2018, is ...
Arcticooling's user avatar
11 votes
1 answer
198 views

Becoming a Perl bandit

I've posted a few questions about natas a wargame. But I'm stuck at natas29 it has to do with Perl. I've never coded in Perl before. Thus to help me beat the last few levels, I decided it is time to ...
Ludisposed's user avatar
  • 11.5k
2 votes
1 answer
437 views

Executing a command using Net::SSH

According to the local cop (rubocop), my method has too many lines. ...
american-ninja-warrior's user avatar
7 votes
1 answer
655 views

Remotely collect server data using Net::OpenSSH Perl

I am newbie in Perl programming and currently trying to use Net::OpenSSH module in my code, my new code as below which the task is to run multiple command in remote server, Code as below:: ...
MrAZ's user avatar
  • 171
5 votes
2 answers
54k views

Python script to execute a command using Paramiko SSH

I wrote this to learn exactly how paramiko worked in Py3. Also to keep as a code snippet for future work-related scripts. I know it can be tweaked and I'm hoping you experienced folks can help with ...
Skeer's user avatar
  • 79
7 votes
2 answers
12k views

Running SSH commands on multiple servers

At the company I work at, we have no real way to quickly execute shell commands on all of our customers systems, which often results in what we call Tiny Tim tasks, ...
Mayube's user avatar
  • 181
3 votes
2 answers
51 views

Log Retrieval Script

I wrote a simple script to retrieve the logs from my website, and place them in a subdirectory called logs. It fetches the logs using sftp. I would like help with ...
HSchmale's user avatar
  • 875
3 votes
1 answer
952 views

Fetching system info using python

The following piece of code does ssh do different servers and fetches the system info and display it to the user: ...
Here_2_learn's user avatar
1 vote
0 answers
1k views

Generating ssh keys from asp.net core

I have started to create a console app, which I am testing locally on my mac. The idea is to generate an ssh key and structure the storage of these keys within the ...
SJC's user avatar
  • 241
3 votes
1 answer
311 views

Basic automation of SSH tasks in a restricted environment

I'm trying to implement a simple automation solution in a restricted environment. I have actually implemented something but it took a bit longer than I wanted. I want to improve the solution and I'll ...
oblio's user avatar
  • 143
7 votes
1 answer
6k views

SFTP Ruby script for downloading files from server

I have written this Ruby script to download some file from server using SFTP. Help me improve this one. Find the original script at this link ...
Ashish Wadekar's user avatar
2 votes
0 answers
477 views

Concurrent SSH session pool

In my application I need to perform several SSH commands from Windows to a Linux machine. Since I need to reduce as much as possible the SSH calls overhead and also limit the number of concurrent ...
digEmAll's user avatar
  • 121
5 votes
1 answer
39k views

Send commands over SSH to server

Here's a very small and basic script that sends commands over SSH to another computer on my network: ...
user2635139's user avatar
3 votes
1 answer
53 views

Moving WordPress database and files to new host

I've written a script in an attempt to try to automate moving hosts from old hosts to our new docker containers. All feedback and input appreciated! ...
JazzCat's user avatar
  • 552
1 vote
1 answer
3k views

Executing remote command using expect from C++

I wrote some code to execute remote commands over ssh, using expect, from c++. The code works but is a bit of a mess of c / c++ since there doesn't seem to be an idiomatic way to achieve much of what ...
cloakedlearning's user avatar
3 votes
1 answer
56 views

Restricted file upload to remote the Ruby way

I am using a Rails web app on the machine webapp, from which I call an action, that pushes a file to a remote server backend. ...
Brauser's user avatar
  • 53
5 votes
2 answers
8k views

Finding all non-empty directories and their files on an SFTP server with Paramiko

The purpose of the following function is to find all non-empty directories, and the files in those non-empty directories. It recursively checks each directory on an SFTP server to see if it has any ...
Matthew Moisen's user avatar
5 votes
2 answers
561 views

SSH passing your Public key to all the users on remote host

I've grown tired of typing my password back and forth to all the hosts you connect to, i want to be able to jump to every single user on all the hosts with ease. So i've made this script with a ...
JazzCat's user avatar
  • 552
1 vote
1 answer
208 views

Ruby backup/restore for provisioning

This is my second Ruby coding attempt. Also - this is my first OOP usage in Ruby. I'm using if __FILE__ == $0 form here - same as it is in Python because it's ...
setevoy's user avatar
  • 797
6 votes
1 answer
1k views

Killing a tunnel and establishing a tunnel through SSH

I have two functions right now: ...
Stupid.Fat.Cat's user avatar
2 votes
1 answer
66 views

Ghostscript check, sends e-mail if one occurs

I've created a program that will search our work server where Ghostscripts occur. How it accomplishes this is by first sshing to the server specified, running a ...
Bam's user avatar
  • 147
2 votes
3 answers
116 views

Systems management using SSH for my school

I wrote this script in order to generate a hosts.txt file with the IP addresses of the laptops in my school. Each laptop is assigned a number, and their IP addresses are assigned to them with the ...
user avatar
6 votes
2 answers
177 views

Cancel those hung print jobs

I've created a program that will list all hung print jobs on a specified server, from there it will load them and strip the jobs down to their Job ID then cancel ...
Bam's user avatar
  • 147
3 votes
1 answer
66 views

Logging the load balance

I created a load balancing server at work and have to keep track of which server it adds the user to, so I wrote a little Ruby script that will do just that. I'm looking for any critique of my work, ...
Bam's user avatar
  • 147
6 votes
1 answer
327 views

Java batch movie downloader

The idea is to batch download a list of movies (torrents) off a torrent site and add them to your server. I have a little bit of Java experience (sophomore in college), so I'm looking for things that ...
Ben's user avatar
  • 161
20 votes
1 answer
496 views

Are your servers down...?

If you came here because of the title, chances are your server isn't down. But if by some miraculous reason it is: A while ago, I posted a program that would ssh and ping all the servers at work. I ...
13aal's user avatar
  • 822