Linked Questions
16 questions linked to/from ssh with separate stdin, stdout, stderr AND tty
243
votes
8
answers
328k
views
Why do I need a tty to run sudo if I can sudo without a password?
I have configured sudo to run without a password, but when I try to ssh 'sudo Foo', I still get the error message sudo: sorry, you must have a tty to run sudo.
Why does this happen and how can I work ...
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 ...
36
votes
2
answers
25k
views
What’s the difference between a “raw” and a “cooked” device driver?
Does this concept only apply to terminal drivers (which is what most sites cover) or to any driver in general?
19
votes
3
answers
6k
views
SSH: Provide additional "pipe" fds in addition to stdin, stdout, stderr
When connecting to a host with SSH, usually three "pipes" are provided between host and guest, for stdin, stdout, and stderr.
Is there a command-line option to create forwards for additional file ...
16
votes
2
answers
6k
views
How to get the real name of the controlling terminal?
How can one get the real name of the controlling terminal (if there is one, else an error) as a pathname?
By "real name", I mean not /dev/tty, which cannot be used by other arbitrary processes to ...
13
votes
2
answers
12k
views
stderr over ssh -t
This sends output to STDERR, but does not propagate Ctrl+C (i.e. Ctrl+C will kill ssh but not the remote sleep):
$ ssh localhost 'sleep 100;echo foo ">&2"'
This propagates Ctrl+C (i.e. Ctrl+C ...
7
votes
3
answers
8k
views
How is Ctrl+c or Ctrl+z sent over SSH?
I am trying to figure out exactly what is sent to an SSH host when I press Ctrl+c in either PuTTY or OpenSSH. All I am trying to do is send control codes programmatically that are equivalent to when a ...
7
votes
1
answer
6k
views
What does "sudo -v" stands for in the sudoers-man-page
The basis for this question is this answer. In the sudoers man-page it is stated that:
timestamp_timeout
Number of minutes that can elapse before sudo will ask for a passwd again.
...
...
2
votes
3
answers
3k
views
How do I get the version of a command inside a bash script
So as the question suggests, I want to get the version of a command inside a bash script, instead of using the terminal.
I know that all available commands are present as files inside the directory /...
3
votes
1
answer
11k
views
How to use sudo privileges when copying files from one machine to another via ssh
Ok, so I already know how to copy a file in my machine to another one, and when I do it, (I'm trying to copy it to a sudo protected directory) it says permission denied. I do not know where to put the ...
7
votes
1
answer
3k
views
Use sudo with ssh command and capturing stdout
I'm trying to run a command as root (via sudo) on a remote server, and capture stdout (but not stderr) into a file.
eg. Something like this:
ssh user@remote "cat /root/file.tar | gzip" > root-...
3
votes
2
answers
2k
views
How do I use ssh with sudo and output redirection to a local file?
What I am trying to do (in bash) is:
for i in <host1> <host2> ... <hostN>; do ssh leroy@$i "sudo -i; grep Jan\ 15 /var/log/auth.log" > $i;done
to get just today's ...
1
vote
1
answer
428
views
Why is stdin input replacing or corrupting my variables when running a script using SSH?
GNU bash, version 4.3.27
I'm running into an odd issue with a script that writes output to a file. The script ssh's to a list of servers and records the state/substate of a few services. I then store ...
0
votes
0
answers
673
views
Why does ssh allocate a tty on server side?
Basically when you run an interactive program on the server you need to use ssh -t instead of ssh. For example:
This works: ssh -t user@server top.
This doesn't work: ssh user@server top.
Question is: ...
2
votes
1
answer
420
views
How to stop program of non-interactive SSH call without pseudo-terminal
Let's say I start a program with a non-interactive SSH call (without pseudo-terminal) and exit the session via CTRLC:
$ ssh user@server -- sleep 123
^C
This way, the program, in this case sleep 123 ...