As of May 31, 2023, we have updated our Code of Conduct.

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
20 votes
1 answer
491 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
  • 812
13 votes
1 answer
124 views

Load SSH key remotely

I often create new accounts or virtual machines, and then have to load my SSH public key/signature in to the authorized keys on that account. That process can be tedious, so I created this script that ...
rolfl's user avatar
  • 97.2k
11 votes
1 answer
193 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
8 votes
1 answer
110 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
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
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
7 votes
1 answer
602 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
6 votes
2 answers
173 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
6 votes
2 answers
326 views

Reading an SSH config file for an IP

I wrote this class which reads an SSH config file and checks whether an IP exists. If the IP does not exist, the class adds a block for that IP address. Header file: ...
zadane's user avatar
  • 327
6 votes
2 answers
173 views

SSH chatting tool

I have taught myself some bash and already knew some AppleScript, so I have come up with this SSH chatting tool for OS X users. It allows you to chat from a terminal to another OS X computer. One ...
insanikov's user avatar
  • 539
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
6 votes
1 answer
318 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
6 votes
2 answers
436 views

Server status checker

I've created a program for work that checks the status of all our servers quickly. What we use to have to do is ssh into each server manually. I'm looking for some ...
13aal's user avatar
  • 812
5 votes
2 answers
555 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
  • 542
5 votes
1 answer
38k 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
5 votes
2 answers
53k 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
4 votes
1 answer
3k views

Sending an XML file to an SFTP site

I have a console application that basically retrieves XML content, writes to the XML file and sends the file to an SFTP site: ...
Sunny's user avatar
  • 369
4 votes
1 answer
46 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
4 votes
1 answer
142 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
4 votes
0 answers
274 views

Command-line ssh address book app

I'm trying to learn a bit about Golang and decided to try out building an SSH address book command-line app. I used a YAML library to serialize and store data in a configuration file. The app has a ...
Inondle's user avatar
  • 141
3 votes
1 answer
369 views

Simple SSH bruteforcer in Ruby

I'm pretty new to Ruby, and working in the IT security field, I thought to make something useful to my work while I learn the language (even though I'm reinventing the wheel). The script is working ...
RedPanda's user avatar
  • 105
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
3 votes
2 answers
190 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
3 votes
1 answer
892 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
3 votes
2 answers
686 views

Locking a remote file

I am using Java to modify remote files in different machines by ssh. At the same time, only one thread is allowed to modify the file in one machine. I implement the logic like this: ...
NingLee's user avatar
  • 175
3 votes
1 answer
88 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
48 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
2 answers
7k 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
3 votes
1 answer
64 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
3 votes
1 answer
57 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
3 votes
1 answer
306 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
3 votes
1 answer
51 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
  • 542
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,832
3 votes
1 answer
54 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
3 votes
1 answer
2k views

Execute script on remote host and obtain variables on localhost

This executes a predefined script on a remote host, and somehow retrieve variable values without affecting STDOUT and STDERR. ...
Devon's user avatar
  • 151
3 votes
0 answers
157 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
3 votes
0 answers
76 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
2 votes
3 answers
114 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 ...
Ethen Crowl's user avatar
2 votes
2 answers
4k views

Uploading a file using Net::SFTP

I have a method to upload a file using the Net::SFTP gem: ...
Jackson's user avatar
  • 153
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
2 votes
1 answer
71 views

Bash menu for accessing network equipment

I wrote a menu in bash to access network equipment, but now there are too many of them to show in one screen to permit selecting one without scrolling up or down. I need it to be improved. I've ...
spwlite's user avatar
  • 21
2 votes
1 answer
415 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
2 votes
1 answer
60 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
0 answers
41 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
2 votes
0 answers
41 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
2 votes
0 answers
449 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
2 votes
0 answers
449 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
1 vote
2 answers
847 views

SSH Class with a method for downloading via SCP

I am looking for a code review on this class. I found myself writing this logic a lot, so trying to save myself some time. ...
fr00z1's user avatar
  • 514
1 vote
2 answers
62 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
1 vote
1 answer
261 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