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

learn more… | top users | synonyms

60
votes
8answers
21k 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, ...
15
votes
4answers
31k 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 ...
58
votes
9answers
33k 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 ...
60
votes
6answers
18k 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 ...
35
votes
4answers
18k 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 ...
14
votes
2answers
2k 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 ...
37
votes
12answers
53k 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 ...
21
votes
3answers
11k 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. ...
6
votes
4answers
2k views

How do I connect to a pc through another pc using ssh

I have three Computers. PC1 and PC2 is on a private LAN, where PC1 is known to PC2 as 192.168.0.2 PC2 and PC3 is on a another LAN, where PC2 is known to PC3 as 192.168.123.101 How can I connect to ...
8
votes
2answers
2k views

Creating a UNIX account which only executes one command

Is there a way to create a user account in Solaris which allows the users to run one command only? No login shell or anything else. I could possibly do it with /usr/bin/false in /etc/passwd and just ...
22
votes
5answers
14k 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 ...
6
votes
8answers
3k views

Automatically run commands over SSH on many servers

There is a list of IP addresses in a .txt file, ex.: 1.1.1.1 2.2.2.2 3.3.3.3 Behind every IP address there is a server, and on every server there is an sshd running on port 22. Not every server is ...
3
votes
6answers
1k views

Common multiple SSH connections file handling issue

often I have to download a file that isn't directly accessable via the first SSH connection. For example I'm on a Windows machine and I want to access another machine that is only accessable from lan. ...
7
votes
2answers
3k views

ssh port forward to access my home machine from anywhere

http://serverfault.com/questions/303937/how-to-make-freebsd-box-accessible-from-internet I want to understand this whole process of port forwarding. I read so many things but failing to understand ...
4
votes
3answers
15k views

Shell Script for logging into a ssh server

I tried writing a shell script which can do automatic login into a ssh server using password which is mentioned in the script. I have written the following code: set timeout 30 /usr/bin/ssh -p 8484 ...
45
votes
4answers
96k 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 ...
19
votes
5answers
10k 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 ...
10
votes
1answer
3k views

How can I configure a reverse SSH connection to the connecting computer?

I'm going to be deploying a number of machines in the near future which will be behind routers. It won't be feasible to set up dynamic DNS on each router and port forwarding, so is there a way I can ...
4
votes
2answers
838 views

How to make password-less login work

I generated a key and copied it to my target: ssh-keygen ssh-copy-id username@hostname I left the the location of the key as default and did not set any passphrase. For a small while after that, I ...
3
votes
2answers
1k views

Is there a way to push shell config information when SSHing to a host?

I know how to set the GNOME-terminals (or xterms!) prompt to green/red regarding the last exit code: vi .bashrc export PROMPT_COMMAND='PS1="` if [[ \$? = "0" ]]; then echo "\\[\\033[0;32m\\]"; else ...
16
votes
3answers
838 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 ...
6
votes
2answers
1k views

Can I set my local machine's terminal colors to use those of the machine I ssh into?

I have a color scheme that I like for when I'm in a terminal, but I ssh into the machine I work on from multiple sources (locally, PuTTY, my netbook, etc.) and I want to maintain the same color scheme ...
7
votes
3answers
3k views

Copying protected files between servers in one line?

I'd like to copy squid.conf from one server to another. The servers don't talk to each other. I'd like to go through my workstation. Both servers have the file, so it will be overwritten on the ...
5
votes
1answer
2k views

Remote desktop over SSH reverse tunnel to replace TeamViewer

I want to open a remote desktop session from my laptop to desktop over my SSH (reverse) tunnel. That should be simple (or at least doable), right? Until now I've been using Team Viewer to log in to ...
6
votes
5answers
5k views

sh startup files over ssh

I have some important commands I need to execute before any sh shell starts. This is required for passing SSH commands in the SSH command (ssh host somecommand) and other programs that run commands. ...
4
votes
3answers
583 views

ssh to private-ip

I have a computer with CentOS (computer A) that configured as has an private ip 10.150.5.141 (with restricted firewall), can access internet and my ArchLinux VPS (computer B) with real ip w.x.y.z How ...
4
votes
1answer
859 views

Tunnel traffic through another machine over ssh

I want to be able to route a portion of my traffic through another machine over SSH. For example, is it possible to browse the web through the ssh tunnel and also browse the web through your LAN ...
27
votes
3answers
11k 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 ...
24
votes
4answers
18k 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 ...
21
votes
4answers
6k 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 ...
12
votes
7answers
23k views

Execute remote commands, completely detaching from the ssh connection

I have 2 computers, localpc and remoteserver. I need localpc to execute some commands on remoteserver. One of the things it needs to do is start a backup script that runs for a number of hours. I ...
14
votes
1answer
16k 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 ...
19
votes
4answers
11k 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 ...
17
votes
6answers
15k 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> ...
15
votes
4answers
4k views

What's the difference between SFTP, SCP and FISH protocols?

I used to think SCP is a tool to copy files over SSH, and copying files over SSH is called SFTP, which is itself a synonym to FISH. But now as I was looking for a Total Commander plugin to do this in ...
5
votes
3answers
3k 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 ...
5
votes
2answers
12k views

SSH and home directory permissions

It took me hours to solve this SSH problem with one of my class accounts on my school's servers. I couldn't ssh into one particular class account without entering my password, while passwordless ...
5
votes
2answers
15k views

How to add a ssh user who only has permissions to access specific folder?

How to add an ssh user who only has permissions to access specific folder? useradd -d /var/www/xyz.com.tr/musteri -s /bin/bash -g sshd musteri I created a user called musteri. I set its home ...
10
votes
3answers
6k views

How do you copy the public key to a ssh-server?

Here is what I have tried, and I got an error: $ cat /home/tim/.ssh/id_rsa.pub | ssh tim@just.some.other.server 'cat >> .ssh/authorized_keys' Password: cat: >>: No such file or directory ...
3
votes
2answers
438 views

SSH tunnel through middleman server - how to connect in one step (using key pair)?

My question is basically how to turn my existing two steps into one step. I have a working SSH tunnel set up between two computers using a middleman server like this: ...
3
votes
1answer
544 views

Route SSH to host through interface

Is it possible to route all outgoing requests for SSH (port 22) to mydynamicdns.afraid.org via wlan0 instead of eth0 when both are connected? Since my IP is dynamic, I would like to use a name ...
23
votes
4answers
4k 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 ...
17
votes
3answers
11k 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 ...
14
votes
4answers
5k 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 ...
14
votes
2answers
9k 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?
19
votes
2answers
2k 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 ...
11
votes
3answers
812 views

Adding a user who can only execute scripts remotely

I would like to create a user who can only do one thing: via ssh specify a script ( and commandline arguments to the script ) that resides in one particular folder ( for the purposes of this question ...
8
votes
2answers
1k views

How to efficiently use 3D via a remote connection?

I have one weak PC (client) but with acceptable 3D performance, and one strong PC (server) which should be capable of running an application using OpenGL twice, i.e. once locally and once remotely for ...
5
votes
4answers
7k views

Set some firewall ports to only accept local network connections?

Basic firewall question: How do I set up the firewall on a system in a LAN so that some ports are only open to connections from the local area network, and not from the outside world? For instance, ...
4
votes
3answers
866 views

Keep running a script via ssh

ssh can use to run remote commands. ssh me@server.com 'long-script.sh' I run a long script that will take a lot of time, but I want to close my computer and keep running the script in the remote ...