Questions tagged [ssh]

SSH (Secure SHell) is a protocol for securely running commands on a remote computer. Use this tag for questions about configuring, using and trouble-shooting SSH client and server software.

SSH is a protocol for securely running commands on a remote computer. It works by creating an encrypted connection between a client and a server listening on port 22 (by default). It was designed in the mid 1990s as a secure replacement for protocols such as Telnet and FTP which exchange data (including authentication tokens) in plain text.

Implementations

  • Dropbear is a lightweight implementation of SSH targeted at embedded devices.
  • OpenSSH, developed by the OpenBSD project, is by far the most common implementation of SSH, both server-side and client-side, in the unix world. If someone mentions SSH in a unix context, assume OpenSSH unless told otherwise.
  • PuTTY is an SSH client mostly found on Windows.

Related programs

  • AutoSSH: Automatically restart SSH sessions and tunnels
  • Corkscrew: tunnel through HTTP proxies
  • SSHFS: mount remote filesystems over SSH

Troubleshooting

If public key authentication doesn’t work: make sure that on the server side, your home directory (~), the ~/.ssh directory, and the ~/.ssh/authorized_keys file, are all writable only by their owner. In particular, none of them must be writable by the group (even if the user is alone in the group). chmod 755 or chmod 700 is OK, chmod 770 is not.

What to check when something is wrong:

  • The most useful source of information for diagnosing problems with SSH connections is the messages logged by the SSH server. These are typically logged to /var/log/secure, /var/log/auth.log, /var/log/daemon.log or similar, depending on the OS/distribution. Relevant log messages should be included in in the question.
  • If you can’t access the server to check the logs, the next best option is to run ssh -vvv to see a lot of debugging output from the client’s perspective. If you post a question asking why you can't connect with SSH, include this output (you may want to anonymize host and user names).
  • If public key authentication isn't working, check the permissions again, especially the group bit (see above).

Further reading

7489 questions
1128
votes
10 answers

How to copy files from one machine to another using ssh

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 system like System A and System B. I'm using…
user3021349
  • 14,809
  • 8
  • 18
  • 21
668
votes
29 answers

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

I'm working from the URL I found here: http://web.archive.org/web/20160404025901/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 bit. I…
Thom
  • 7,245
  • 4
  • 17
  • 16
605
votes
10 answers

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 key) I found a way: mv ~/.ssh/id_rsa…
LanceBaynes
  • 36,957
  • 90
  • 243
  • 345
555
votes
7 answers

Scroll inside Screen, or Pause Output

I use screen for my command-line tasks while managing the servers where I work. I usually run small commands (mostly file-system tasks) but sometimes I run more extensive tasks (like DBA). The output of those tasks is important to me. Since I use…
AeroCross
  • 6,083
  • 4
  • 16
  • 7
505
votes
12 answers

How to forward X over SSH to run graphics applications remotely?

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 LAN. I know that the -X option enables X11…
Mr. Shickadance
  • 6,484
  • 6
  • 24
  • 27
464
votes
5 answers

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 Easy, reverse SSH tunneling can be used to get around…
Ali
  • 5,111
  • 5
  • 18
  • 18
375
votes
2 answers

How to list keys added to ssh-agent with ssh-add?

How and where can I check what keys have been added with ssh-add to my ssh-agent ?
Patryk
  • 12,536
  • 20
  • 50
  • 58
363
votes
4 answers

Specify identity file (id_rsa) with rsync

I need to make periodic backups of a directory on a remote server which is a virtual machine hosted by a research organisation. They mandate that access to VMs is through ssh keys, which is all good, except that I can't figure out how to point rsync…
Jangari
  • 4,048
  • 2
  • 12
  • 9
328
votes
20 answers

How can I run ssh-add automatically, without a 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 log in on a specific machine, how can I do it so that it's set up once and it doesn't ask me for the…
zdun8
  • 3,447
  • 4
  • 13
  • 8
316
votes
10 answers

Copy a file back to local system with ssh

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 from the remote system back to the local system?
Shawn J. Goff
  • 43,698
  • 23
  • 131
  • 143
286
votes
11 answers

Keep processes running after SSH session disconnects

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 later, after dinner, I want to check on the process…
λ Jonas Gorauskas
  • 3,470
  • 3
  • 19
  • 19
284
votes
6 answers

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 I'm still using the same home directory. $ cat…
tshepang
  • 61,932
  • 85
  • 220
  • 285
282
votes
2 answers

What's ssh port forwarding and what's the difference between ssh local and remote port forwarding

I feel confused about ssh port forwarding and the difference between ssh local and remote port forwarding. Could you please explain them in detail and with examples? Thanks!
user2886717
  • 3,189
  • 5
  • 16
  • 14
281
votes
6 answers

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 arcfour,blowfish-cbc Protocol 2 ControlMaster…
Amelio Vazquez-Reina
  • 37,679
  • 75
  • 188
  • 285
266
votes
28 answers

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: administratively prohibited: open failed What does this…
Neil
  • 3,182
  • 2
  • 16
  • 15
1
2 3
99 100