SSH (Secure SHell) is a protocol for running commands on a remote computer.

learn more… | top users | synonyms

82
votes
6answers
39k views

Keep SSH Sessions running after disconnection

I sometimes have long running processes that I want to kick off before going home, so I create a SSH session to the server to start the process, but then I want to close my laptop and go home and ...
78
votes
9answers
55k views

SSH easily copy file to local system

If I'm logged in to a system via SSH, is there a way to copy a file back to my local system without firing up another terminal or screen session and doing scp or something similar or without doing SSH ...
73
votes
8answers
30k views

How can I disown a running process and associate it to a new screen shell?

I have a running program on a SSH shell. I want to pause it and be able to unpause its execution when I come back. One way I thought of doing that was to transfer its ownership to a screen shell, ...
67
votes
6answers
147k views

How to forward X over SSH from Ubuntu machine?

I have a machine running Ubuntu which I SSH to from my Fedora 14 machine. I want to forward X from the Ubuntu machine back to Fedora so I can run graphical programs remotely. Both machines are on a ...
65
votes
18answers
88k views

Why am I still getting a password prompt with ssh with public key authentication?

I'm working from the URL I found here: http://jaybyjayfresh.com/2009/02/04/logging-in-without-a-password-certificates-ssh/ My ssh client is Ubuntu 64 bit 11.10 desktop and my server is Centos 6.2 64 ...
52
votes
4answers
28k views

How does reverse SSH tunneling work?

As I understand this, firewalls (assuming default settings) deny all incoming traffic that has no prior corresponding outgoing traffic. Based on Reversing an ssh connection and SSH Tunneling Made ...
50
votes
3answers
32k views

how can shellshock be exploited over SSH?

Apparently, the shellshock Bash exploit CVE-2014-6271 can be exploited over the network via SSH. I can imagine how the exploit would work via Apache/CGI, but I cannot imagine how that would work over ...
44
votes
7answers
15k views

Is it possible to run ssh-copy-id on port other than 22?

I have a server with SSH running on a non-standard port. Instead of 22, it runs on 8129. To log in, I use: ssh -p 8129 hostname Now, whenever I need to set up a key for password-less login, I have ...
44
votes
2answers
5k views

How does SSH connection survive a network restart?

From a Linux SSH shell, type /etc/init.d/network restart to restart the network service. I expect my SSH connection to die since the network service goes down. But it doesn't. Very cool. But how does ...
43
votes
13answers
63k views

SSH tunneling error: “channel 1: open failed: administratively prohibited: open failed”

When I open this ssh tunnel: ssh -nXNT -p 22 localhost -L 0.0.0.0:8984:remote:8983 I get this error when trying to access the HTTP server running on localhost:8984: channel 1: open failed: ...
40
votes
4answers
40k views

What do the options `ServerAliveInterval` and `ClientAliveInterval` in sshd_config do, precisely?

I found this question, but I'm sorry I don't quite understand the settings on the two variables ServerAliveInterval and ClientAliveInterval mentioned in the accepted response. If my local server is ...
38
votes
3answers
48k views

ssh-add complains: Could not open a connection to your authentication agent

I've been trying to get ssh-add working on a RaspberryPi running Raspbian. I can start ssh-agent, when I do it gives the following output into the terminal: ...
38
votes
1answer
6k views

Kill an unresponsive ssh session without closing the terminal

Is there a way to disconnect from an SSH session that has become unresponsive without killing the whole terminal? Specifically I'm using konsole, and the machine I'm working with sometimes hangs, but ...
34
votes
4answers
4k views

Why is root login via SSH so bad that everyone advises to disable it?

Everybody on the Internet advises to disable root login via SSH as it is a bad practice and a security hole in the system, but nobody explains why it is so. What is so dangerous in enabling root ...
33
votes
1answer
2k views

redirect sound (microphone) via ssh, how to telephone via ssh?

How can I redirect the microphone of one computer to listen to it on another computer via ssh? Which is the right device or which is the right command line? Some years ago it was easy and fun to ...
32
votes
3answers
14k views

How can I break away from an SSH session that has crashed?

Many times I have an SSH session that doesn't respond anymore (for example, when I lose internet connection and then reconnect). Ctrl+C, Ctrl+D, Ctrl+Z and a zillion of key presses don't have any ...
31
votes
5answers
26k views

What does the Broken pipe message mean in an SSH session?

Sometimes my SSH session disconnects with a Write failed: Broken pipe message. What does it mean? And how can I keep my session open? I know about screen, but that's not the answer I'm looking for. I ...
30
votes
5answers
21k views

How to speed my too-slow ssh login?

Running ssh user@hostname takes ~30s. Here's the scenario: this is a VM on the local LAN Windows and Mac machines get instant login am using Debian and I could reproduce with an Ubuntu machine ...
28
votes
4answers
18k views

Is it possible to find out the hosts in the known_hosts file?

I would like to see what hosts are in my known_hosts file but it doesn't appear to be human readable. Is it possible to read it? More specifically there is a host that I can connect to via several ...
26
votes
3answers
10k views

How to force ssh client to use only password auth?

If I use pubkey auth from e.g.: an Ubuntu 11.04 how can I set the ssh client to use only password auth to a server? (just needed because of testing passwords on a server, where I default log in with ...
26
votes
4answers
2k views

How do I play an HTTP music stream over SSH?

I know I can just do mplayer <stream> to open and play a stream on the local machine. However, I'm behind a firewall. Instead, I'd like to open the stream on a remote machine, but still play it ...
26
votes
5answers
25k views

scp without replacing existing files in the destination

How do I copy an entire directory into a directory of the same name without replacing the content in the destination directory? (instead, I would like to add to the contents of the destination folder) ...
25
votes
4answers
95k views

How to copy files from one machine to another using ssh [duplicate]

I'm using Linux (centos) machine, I already connected to the other system using ssh. Now my question is how can I copy files from one system to another system? Suppose, in my environment, I have two ...
25
votes
2answers
2k views

Is it safe to give out my SSH public key for work?

I currently work remotely for a number of organizations which need me to access their servers regularly for maintenance and upgrades. Is it safe for me to add my RSA public SSH key to the ...
25
votes
4answers
5k views

Is there a way to communicate with someone at their desktop?

My wife is sitting at her home desktop, alpha, which is running a recent version of Ubuntu. I am on a bus, using ConnectBot on my G1 phone, and can SSH into alpha from wherever I am. For complicated ...
24
votes
6answers
8k views

Can I find out which ssh key was used to access an account?

Is it possible to find out which ssh key was used to access an account? I have an account on a server that I let several (trusted!) people have access to via ssh. I'd find it useful to be able to ...
24
votes
4answers
7k views

Can mouse wheel scrolling work in a /usr/bin/screen session?

Is there any way to use the mouse wheel to scroll through the output of a screen session? I can use the keypad scroll through previous output in screen after pressing ctrl+a [. Is it possible to do ...
23
votes
4answers
21k views

What is the point of sshd “UseDNS” option?

I know what it does, but i don't know why. What attack(s) does it prevent ? Is it relevant for all kind of authentication methods ? (hostbased, password, publickey, keyboard-interactive ...)
22
votes
5answers
14k views

Using while loop to ssh to multiple servers

I have a file servers.txt, with list of servers: server1.mydomain.com server2.mydomain.com server3.mydomain.com when I read the file line by line with while and echo each line, all works as ...
22
votes
4answers
41k views

Open a window on a remote X display (why “Cannot open display”)?

Once upon a time, DISPLAY=:0.0 totem /path/to/movie.avi after ssh 'ing into my desktop from my laptop would cause totem to play movie.avi on my desktop. Now it gives the error: No protocol ...
22
votes
3answers
19k views

SSH inside SSH fails with “stdin: is not a tty”

I'm trying to connect to machine one with ssh and then connect to another machine two with ssh, but I get this error. ssh user@computerone.com 'ssh otheruser@computertwo.com' stdin: is not a tty ...
22
votes
5answers
14k views

SSH to decrypt encrypted LVM during headless server boot?

When I installed Ubuntu 10.04 and, now, 10.10, I was offered the option of enabling "encrypted LVM" for my hard drive. After choosing that option, I am prompted for my password during boot to decrypt ...
22
votes
3answers
19k views

Restricting an SSH/SCP/SFTP user to a directory

Is there a simple way to restrict an SCP/SFTP user to a directory? All methods that I've come across require me to set a chroot jail up by copying binaries, but I don't think that should be necessary. ...
21
votes
3answers
19k views

How can I run ssh-add automatically, without password prompt?

I want to communicate between several computers on my network (static ethernet), through ssh. In order to do that I need to run ssh-add every time I login on specific machine, how can I do it so that ...
21
votes
4answers
14k views

How to speed up X over SSH on a slow network connection?

Are there any specific recommendations on speeding up X applications over ssh on a slow network connection? In this specific case, I am accessing a server located in west coast from a laptop in east ...
21
votes
4answers
7k views

Quoting in ssh $host $FOO and ssh $host “sudo su user -c $FOO” type constructs

I often end up issuing complex commands over ssh; these commands involve piping to awk or perl one-lines, and as a result contain single quotes and $'s. I have neither been able to figure out a hard ...
21
votes
3answers
6k views

How to enable autocompletion for remote paths when using scp?

I remote copied a file to my laptop using: scp someFile USER@192.168.178.32:/home/USER/put/it/some/where/oh/damn/you/here I want to be able to autocomplete the remote path by hitting tab.
20
votes
5answers
32k views

Uploading directories with sftp?

I'm having some trouble uploading directories(which contain other directories a few levels deep) by sftp. I realize I could work around this by gzipping, but I don't see why that's necessary. Anyway, ...
20
votes
2answers
3k views

SSH output isn't line buffered?

I'm running a script on a remote machine like this: ssh $host "pip install -r /path/to/requirements.txt" But the output isn't line buffered; instead of seeing one line returned at a time, all the ...
20
votes
2answers
4k views

Using an already established SSH channel

I have an already established ssh connection between two machines. Is there a way to send commands to the remote machine from a shell script that is run on the local machine, using the already open ...
20
votes
1answer
25k views

How does tcp-keepalive work in ssh?

I am trying to code a shell-script that uses a ssh-connection for doing "heartbeats". I want to terminate the client- and server-side of that connection after a certain timeout (after the connection ...
20
votes
3answers
8k views

What is a better way to deal with server disconnects of sshfs mounts?

I have several directories mounted through sshfs. I sometimes get disconnects from the server (not configurable by me). I usually mount the directories like this sshfs ...
19
votes
3answers
7k views

Multiple similar entries in ssh config

Say I want to configure my ssh options for 30 servers with the same setup in my .ssh config file: host XXX HostName XXX.YYY.com User my_username Compression yes Ciphers ...
18
votes
4answers
7k views

How can I detect if the shell is controlled from SSH?

I want to detect from a shell script (more specifically .zshrc) if it is controlled through SSH. I tried the HOST variable but it's always the name of the computer which is running the shell. Can I ...
18
votes
2answers
662 views

What's the purpose of the randomart image for user (not host) SSH keys?

The ssh-keygen generates the following output: The key fingerprint is: dd:e7:25:b3:e2:5b:d9:f0:25:28:9d:50:a2:c9:44:97 user@machine The key's randomart image is: +--[ RSA 2048]----+ | .o o.. ...
17
votes
3answers
1k views

ssh via multiple hosts

To get to my machine in my office, at the moment I am doing this: me@home:~$ ssh unix.university.com me@unix:~$ ssh unix.department.univeristy.com me@unix.department:~$ ssh ...
17
votes
4answers
16k views

How can I tell what version of linux I'm using?

Often times I will ssh into a new client's box to make changes to their website configuration without knowing much about the server configuration. I have seen a few ways to get information about the ...
17
votes
2answers
7k views

How do I know if my ssh tunnel is created successfully?

I rely on the following script tunnel.sh written by others to keep a ssh tunnel alive: #!/bin/bash export SSH_HOST=tim@server if [ ! -f /tmp/.tunnel ] then echo "Creat SSH tunnel" ssh -f -D 9999 ...
17
votes
2answers
13k views

Is it possible to set Gnome Terminal's title to “user@host” for whatever host I'm connected to?

I'd like to set the terminal title to user@host so I can easily tell which machine I'm connected to from the window title. Is there a way to do this from SSH or from GNOME Terminal?
17
votes
6answers
19k views

How can I run a script immediately after connecting via SSH?

I started to ask this question but answered it while I had it open. I'm going to post this question, follow it up with my solution and leave it open to other potential solutions. <backstory> ...