Linked Questions
10 questions linked to/from Why do I need a tty to run sudo if I can sudo without a password?
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),...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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.
...
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.
...