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

learn more… | top users | synonyms

22
votes
2answers
6k 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 ...
21
votes
4answers
8k 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
76k views

ssh_exchange_identification: Connection closed by remote host (not using hosts.deny)

I'm not using hosts.allow or hosts.deny, further more SSH works from my windows-machine (same laptop, different hard drive) but not my Linux machine. ssh -vvv root@host -p port gives: OpenSSH_6.6, ...
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
3answers
15k views

Why SSH takes a long time to Connect

I have noticed that some Linux Servers in Network takes long time to connect using ssh. Situations: There are two situations I have faced: On some servers some times it takes a long time to ask ...
19
votes
5answers
1k views

How can I propagate my SSH pub key to a list of servers without having to type my password in over and over?

I was recently given username/password access to a list of servers and want to propagate my SSH public key to these servers, so that I can login more easily. So that it's clear: There is not any ...
19
votes
4answers
19k views

Is there ever a reason to use scp instead of rsync?

Is there a reason to use scp instead of rsync? I can see no reason for using scp ever again, rsync does everything that scp does, with more safety (can preserve symlinks etc).
19
votes
2answers
8k 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 ...
18
votes
4answers
7k views

Why does `cd` command not work via SSH?

I was trying to backup some files via SSH but instead of tar'ing the ones I wanted I got my home folder. I did some further testing and it boils down to this: ssh root@server /bin/sh -c "cd /boot ...
18
votes
4answers
57k views

SSH login with clear text password as a parameter?

I need to login to a user that I've created on a remote host running Ubuntu. I can't use an ssh key because the ssh login will happen from a bash script ran within a server that I wont have access to ...
17
votes
2answers
1k views

Why is this binary file 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 ...
17
votes
3answers
8k views

How can I determine if someone's SSH key contains an empty passphrase?

Some of my Linux & FreeBSD systems have dozens of users. Staff will use these "ssh gateway" nodes to SSH into other internal servers. We're concerned that some of these people use an unencrypted ...
17
votes
2answers
26k 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 ...
17
votes
5answers
2k views

Why is Firefox so slow over SSH?

I try to launch Firefox over SSH, using ssh -X user@hostname and then firefox -no-remote but it's very very slow. How can I fix this? Is it a connection problem?
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
3answers
16k 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
22k 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> ...
17
votes
3answers
29k views

Can I connect to Windows machine from Linux shell?

I can connect to Linux machines from Windows using PuTTY/SSH. I want to do the other way round - connect to a Windows machine from Linux. Is this possible?
17
votes
3answers
2k views

How to prevent shutdown when an SSH user is logged in?

I'm administrating a networked environment and I had an interesting situation arise yesterday. When a host is required to shutdown by a regular user, it refuses to do so if other users are logged in ...
16
votes
3answers
4k views

What are the pros/cons of the various methods to block brute force SSH attacks?

There are a number of different packages out there to shut out IPs from which brute-force SSH attacks are launched on your system. For example: DenyHosts Sshguard fail2ban What are the pros/cons ...
16
votes
1answer
11k views

sshfs mount, sudo gets permission denied

I am using sshfs to mount a folder with some python projects over ssh to my ~/ directory. $ mkdir -p ~/mount/my-projects $ sshfs user@example.com:/home/user/my-projects ~/mount/my-projects I can ...
16
votes
4answers
8k 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 ...
16
votes
3answers
5k views

How to close (kill) ssh ControlMaster connections manually

With the following .ssh/config configuration: ControlMaster auto ControlPath /tmp/ssh_mux_%h_%p_%r ControlPersist 4h How to close the persisting connection before the 4 hours? I know you can make ...
16
votes
3answers
13k views

What difference between openssh key and putty key?

I've found that ssh-keygen ("ssh" package) produces different keys from puttygen ("putty" package). If I create public and private keys with ssh-keygen some ssh-servers will not accept my keys. If I ...
16
votes
4answers
7k views

Can I pipe /dev/video over ssh

I have two computers, a desktop in my office ( with a webcam attached ) and a laptop somewhere else on the network. Usually I take a look at my office through my webcam by running ssh Office -Y ...
15
votes
3answers
1k views

Why change default ssh port?

I've noticed lot of admins change default ssh port. Is there any rational reason to do so?
15
votes
1answer
625 views

Transfer a file over a unstable SSH connection

I'm trying to upload some big files (around 10GB) with a slow upload speed (200kb/s) on a often disconnected SSH connection (due to poor network conditions). I'm trying to use scp, but if there is a ...
15
votes
1answer
20k views

scp and compress at the same time, no intermediate save

What is the canonical way to: scp a file to a remote location compress the file in transit (tar or not, single file or whole folder, 7za or something else even more efficient) do the above without ...
15
votes
1answer
5k 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 ...
14
votes
2answers
2k views

Accidently created a file called -X, how can I delete it? [duplicate]

Possible Duplicate: How do I delete a file whose name begins with “-” (hyphen a.k.a. dash or minus)? Like an idiot, I ran this command: tar -cf -X awstats-icon icon ...
14
votes
7answers
48k 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
6answers
19k views

How can I page up or down in tmux with Terminal.app?

I have tmux installed. But I can not scroll up or down. I.e. as soon as I tmux I get only a portion of the screen and can not scroll up. crtl-b + Page Up does not work since I am in Mac and I can not ...
14
votes
4answers
11k views

How to avoid being asked passphrase each time I push to Bitbucket

I set up my ssh stuff with the help of this guide, and it used to work well (I could run hg push without being asked for a passphrase). What could have happened between then and now, considering that ...
14
votes
3answers
17k 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 ...
14
votes
3answers
10k views

Encrypting file only with SSH -priv-key?

Suppose I want to encrypt a file so that only I can read it, by knowing my SSH private key password. I am sharing a repo where I want to encrypt or obfuscate sensitive information. By that, I mean ...
14
votes
2answers
5k views

(SSH) Is it dangerous to close terminal without “exit”?

This happened many times. While the SSH active, I'm so tired and just close the terminal without exit Is it dangerous to doing like that?
14
votes
5answers
6k views

Does a `scp` transfer close when I close the shell?

I have scp transfer (from one remote server to another), that is quite big. So maybe I want close the computer from which I executed this command, will this end the transfer? I have ssh access to ...
14
votes
3answers
2k views

How to tell if SSH'd into machine? [duplicate]

Is it possible to tell if a terminal is SSH'd into a machine ? some kind of command to do this for me and execute something if I am SSHd?
14
votes
2answers
7k views

ssh-add is not persistent between reboots

I add a ssh key to the agent by $ ssh-add ~/.ssh/id_rsa_mac Identity added: /Users/alex/.ssh/id_rsa_mac (/Users/alex/.ssh/id_rsa_mac) After reboot I don't have this key added anymore: $ ssh-add -l ...
14
votes
2answers
11k views

SSHFS specify key

I've got a question that I've not been able to find an answer for. I have two computers, both of which run Ubuntu Linux 12.04. I have set up my first computer ("home") to be able to SSH into my second ...
14
votes
3answers
9k views

SSH: tunnel without shell on ssh server

I have to set up a tunnel between two hosts. For this i use ssh in this way: ssh -L MY_LOCAL_PORT:FOREIGN_ADDRESS:FOREIGN_PORT MYUSER@SSH_SERVER after that, I login into my SSH_SERVER. How can I ...
14
votes
6answers
3k views

OS X: how to keep the computer from sleeping during a ssh session

When I ssh into a OS X computer on my network the session lasts until the OS X goes into sleep mode. Is there a way to prevent this from happening during my SSH session, apart from physically bumping ...
14
votes
2answers
2k views

Will my MySQL query continue to run even if my ssh connection drops?

I've connected to a server over SSH and logged in to mysql, and asked it to run a query (the results of which are dumped into a CSV) that could take well over an hour. Although I have instructed my ...
14
votes
3answers
11k views

Tell SSH to use a graphical prompt for key passphrase

How can I force SSH to request passphrases using a graphical prompt (GTK, for example) instead of the standard one that uses the terminal? I tried setting SSH_ASKPASS=/usr/bin/ssh-askpass but it ...
14
votes
4answers
8k views

How can I solve this ssh-agent problem?

I'm using Linux Mint, and have not been able to get gnome-keyring to unlock automatically at login, it seems. A symptom of my problem is as follows: $ ssh-add Identity added: /home/me/.ssh/id_rsa ...
13
votes
8answers
2k views

How can we limit the impact of ssh probes?

My webserver is constantly attacked by various IP addresses. They try five passwords and then change the IP address. I have done various lockdowns like using ssh-keys and not permitting passwords, ...
13
votes
4answers
920 views

What is SSH - the protocol and what is ssh - the utility?

What is SSH - the protocol? What is ssh - the unix utility and how does it work? How is SSH protocol related to SFTP? What is sshd? Does the command su use ssh or sshd?
13
votes
6answers
6k views

How do I copy all files and directories except certain ones over ssh?

Using the Linux command line, I use the scp command to copy up all the files and folders from a certain directory. However, I don't like to consume wasted bandwidth for copying up things I rarely ...
13
votes
5answers
14k views

how to avoid ssh asking permission?

We are attempting to speed up the installation of oracle nodes for RAC installation. this requires that we get ssh installed and configured so that it doesn't prompt for a password. The problem is: ...
13
votes
3answers
21k views

Which users are allowed to log in via SSH by default?

When I set up my Debian 6, I was wondering, which users apart from root whose password I know can log into my system via SSH? When I install Apache 2 a user called www-data gets created. Does this ...