The Stack Overflow podcast is back! Listen to an interview with our new CEO.

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
0
votes
0answers
16 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 ...
3
votes
1answer
38 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 ...
3
votes
1answer
35 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: ...
4
votes
1answer
67 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 ...
3
votes
2answers
51 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 ...
1
vote
1answer
2k 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 ...
1
vote
2answers
374 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/...
0
votes
1answer
157 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 ...
7
votes
1answer
81 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, ...
2
votes
0answers
242 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 ...
4
votes
1answer
36 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 ...
1
vote
1answer
77 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 ...
11
votes
1answer
158 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 ...
2
votes
1answer
161 views

Executing a command using Net::SSH

According to the local cop (rubocop), my method has too many lines. ...
7
votes
1answer
256 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:: ...
5
votes
2answers
39k 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 ...
6
votes
2answers
7k 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, ...
3
votes
2answers
33 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 ...
3
votes
1answer
442 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: ...
1
vote
0answers
718 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 ...
3
votes
1answer
259 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 ...
7
votes
1answer
3k 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 ...
1
vote
0answers
337 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 ...
-1
votes
1answer
688 views

Simple PHP SSH2 Class

I've written a simple PHP SSH2 wrapper class. Please review the code and point out mistakes. ...
4
votes
1answer
30k 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: ...
3
votes
1answer
39 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! ...
1
vote
1answer
2k 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 ...
3
votes
1answer
46 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. ...
1
vote
2answers
3k 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 ...
4
votes
2answers
518 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 ...
1
vote
1answer
158 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 ...
5
votes
1answer
774 views

Killing a tunnel and establishing a tunnel through SSH

I have two functions right now: ...
2
votes
1answer
49 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 ...
2
votes
3answers
106 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 ...
6
votes
2answers
165 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 ...
3
votes
1answer
62 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, ...
6
votes
1answer
286 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 ...
20
votes
1answer
348 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 ...
6
votes
2answers
404 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 ...
3
votes
0answers
200 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 ...
6
votes
2answers
288 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: ...
3
votes
1answer
282 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 ...
12
votes
1answer
101 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 ...
2
votes
1answer
68 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 ...
5
votes
2answers
145 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 ...
3
votes
1answer
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. ...
2
votes
2answers
3k views

Uploading a file using Net::SFTP

I have a method to upload a file using the Net::SFTP gem: ...
3
votes
2answers
528 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: ...
1
vote
2answers
819 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. ...
4
votes
1answer
2k 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: ...