Linked Questions

36 votes
4 answers
145k views

How to delete a file on remote machine via SSH by using a shell script?

I am writing a shell script where I have to delete a file on a remote machine via a shell script. Manual workflow: Log on to remote machine: ssh [email protected] At the remote machine (domain),...
mico's user avatar
  • 701
38 votes
2 answers
13k views

Why is this binary file transferred over "ssh -t" being changed?

I am trying to copy files over SSH, but cannot use scp due to not knowing the exact filename that I need. Although small binary files and text files transfer fine, large binary files get altered. Here ...
dotancohen's user avatar
  • 16.5k
4 votes
1 answer
28k views

"sudo: sorry, you must have a tty to run sudo" when using sudo in a remote script

I want to run a series of sudo-elevated commands on a remote machine from an embedded script. To simplify the question, I'm just trying to run sudo id and get it to tell me that it's root. I am ...
Andy's user avatar
  • 49
10 votes
1 answer
5k views

ssh with separate stdin, stdout, stderr AND tty

Problem Consider a command like this: <binary_input ssh user@server 'sudo tool' >binary_output 2>error.log where tool is arbitrary and ssh is a wrapper or some ssh-like-contraption that ...
Kamil Maciorowski's user avatar
2 votes
1 answer
5k views

forcing sudo on remote rsync server

I'm setting up rsync to transfer files from ServerA to ServerB, and need to preserve timestamps and permissions. They key here is the files are owned by a different account than the one performing ...
a coder's user avatar
  • 3,343
0 votes
1 answer
3k views

Logs of the command running in the remote machine using ssh

I am sshing into a remote machine and running a command there using sudo. I am using tt for TTY connection. I want to get the output (the console logs) of the command that I am running in my local ...
user2851669's user avatar
4 votes
1 answer
674 views

How can we disconnect a file descriptor from any file?

In bash we can create a connection between a file descriptor and a file, e.g. by exec > /path/to/myfile which connects fd 1 to the file. I was wondering how we can disconnect a fd from any file ...
Tim's user avatar
  • 107k
2 votes
0 answers
1k views

problems executing a script on boot-up with systemd

I am connecting from my BeagleBone running Debian to a cellular modem. In order to connect, I enter command pppd file /etc/ppp/peers/zdial & Now, in order to execute this command on boot-up, I ...
Engineer999's user avatar
  • 1,233
2 votes
1 answer
177 views

Redirect multiple Bash code files to SSH with Escaping (same SSH session)

Need to redirect 3 bash code files (possibly more in the future) to SSH, escaping them (within the same SSH session) to execute them on remote host. Perfectly fine to list bash code files manually. ...
strider's user avatar
  • 101
0 votes
1 answer
181 views

wp.cli and sendmail not working via cron but do work when manually run

Not sure if this belongs on Wordpress Stackexchange or here. I think here as the last line in my code is not Wordpress specific. I have the following code in a .sh file which I run weekly using Cron. ...
Laurence Cope's user avatar