Questions tagged [ssh]

GENERAL SSH SUPPORT IS OFF-TOPIC. Support questions may be asked on https://superuser.com. Secure Shell (SSH) is a cryptographic network protocol for secure data communication. Use this tag for programming questions related to Secure Shell. Common authentication and configuration problems are off-topic for Stack Overflow.

Secure Shell (SSH) is a cryptographic network protocol for secure data communication, remote shell services or command execution and other secure network services between two networked computers that it connects via a secure channel over an insecure network: a server and a client (running SSH server and SSH client programs, respectively). The protocol specification distinguishes two major versions that are referred to as SSH-1 and SSH-2.

SSH was designed as a replacement for Telnet and other insecure remote shell protocols such as the Berkeley rsh and rexec protocols, which send information, notably passwords, in plaintext, rendering them susceptible to interception and disclosure using packet analysis. The encryption used by SSH is intended to provide confidentiality and integrity of data over an unsecured network, such as the Internet, although files leaked by Edward Snowden indicate that the National Security Agency can sometimes decrypt SSH.

SSH uses public-key cryptography to authenticate the remote computer and allow it to authenticate the user, if necessary. There are several ways to use SSH; one is to use automatically generated public-private key pairs to simply encrypt a network connection and then use password authentication to log on.

Another is to use a manually generated public-private key pair to perform the authentication. This method allows users or programs to log in without having to specify a password. Anyone can produce a matching pair of different keys (public and private). The public key is placed on all computers that must allow access to the owner of the matching private key (the owner keeps the private key secret). Although authentication is based on the private key, the key itself is never transferred through the network during authentication. SSH only verifies whether the same person offering the public key also owns the matching private key.

In all versions of SSH it is important to verify unknown public keys, i.e. associate the public keys with identities, before accepting them as valid. Accepting an attacker's public key without validation will authorize an unauthorized attacker as a valid user.

Useful Links

Server Implementations

Client Implementations

Libraries

29979 questions
196
votes
7 answers

How do I reattach to a detached mosh session?

How do I reattach to a detached mosh session or otherwise get rid of Mosh: You have a detached Mosh session on this server (mosh [XXXX]). i.e. what's the mosh equivalent of screen -D -R or possibly screen -wipe Furthermore, where can this answer…
John Baber-Lucero
  • 2,556
  • 3
  • 16
  • 19
192
votes
5 answers

Copying files from server to local computer using SSH

I am having trouble copying files from a remote server using SSH. Using PuTTY I log in to the server using SSH. Once I find the file I would like to copy over to my computer, I use the command: scp username@host.com:/dir/of/file.txt \local\dir\ It…
Vincent
  • 1,933
  • 2
  • 11
  • 6
191
votes
6 answers

How to make a program continue to run after log out from ssh?

Possible Duplicate: Prevent a background process from being stopped after closing SSH client I have a program that takes a lot of time to finish. It is running as root over ssh. I want it to continue to run after I logout,is this possible and how…
omg
  • 136,412
  • 142
  • 288
  • 348
189
votes
5 answers

Disable password authentication for SSH

I'm looking for a way to disable SSH clients from accessing the password prompt as noted here. I am unable to disable the password: prompt for root login. I have change the sshd_config file to read: ChallengeResponseAuthentication…
Matt Stokes
  • 4,618
  • 9
  • 33
  • 56
187
votes
15 answers

How to run ssh-add on windows?

I'm following #335 Deploying to a VPS , and near the end of the episode, we need to run ssh-add to give server access to github repo. The problem is how do I run it in windows? What need to install? I know that to run ssh to access the remote…
ZK Zhao
  • 19,885
  • 47
  • 132
  • 206
185
votes
16 answers

How to ssh to vagrant without actually running "vagrant ssh"?

I would like to reproduce the way Vagrant logs in to my VM within a shell script using an ssh command, so I create an alias to my Vagrant instance. What is the command syntax to use the regular ssh command to access it?
Kevin Burke
  • 61,194
  • 76
  • 188
  • 305
183
votes
9 answers

.ssh/config: "Bad configuration option: UseKeychain" on Mac OS Sierra 10.12.6

I am trying to set up my ssh config on the Mac (Mac OS Sierra 10.12.6) in such a way that it stores the passphrase for my ssh key in the keychain. Previously I could do that with ssh-add -K ~/.ssh/id_rsa But recently this doesn't seem to work…
Michael Lihs
  • 7,460
  • 17
  • 52
  • 85
183
votes
12 answers

How to install sshpass on Mac?

I would like to automate ssh login from my Mac. It does have a simple solution: sshpass -p my_password ssh m_username@hostname But my problem is installing sshpass on my Mac.
Alt
  • 2,597
  • 5
  • 26
  • 36
177
votes
17 answers

git-upload-pack: command not found, when cloning remote Git repo

I have been using git to keep two copies of my project in sync, one is my local box, the other the test server. This is an issue which occurs when I log onto our remote development server using ssh; git clone…
Chris Huang-Leaver
  • 6,059
  • 6
  • 41
  • 67
177
votes
5 answers

While loop stops reading after the first line in Bash

I have the following shell script. The purpose is to loop thru each line of the target file (whose path is the input parameter to the script) and do work against each line. Now, it seems only work with the very first line in the target file and…
bcbishop
  • 2,193
  • 3
  • 20
  • 23
175
votes
7 answers

Connect over SSH using a .pem file

I would like to know how to connect over SSH using a .pem file to any server. Currently I'm executing the following command: ssh user@mydomain.example What option should I use?
danielrvt
  • 10,177
  • 20
  • 80
  • 121
173
votes
23 answers

SSH to Vagrant box in Windows?

I'm using Vagrant to start a VirtualBox VM in windows. In other platforms, I can just $ vagrant ssh to connect to the VM. How do i connect to this Vagrant box in windows? The way suggested in Vagrant documentation to use PuTTy also did not…
Sathish
  • 20,660
  • 24
  • 63
  • 71
172
votes
18 answers

Git's famous "ERROR: Permission to .git denied to user"

I have tried googling and read through https://help.github.com/en/articles/connecting-to-github-with-ssh and various, various guides. I am unable to git push -u origin master or git push origin master ( the same command ). I've had my git account…
meder omuraliev
  • 183,342
  • 71
  • 393
  • 434
172
votes
32 answers

Vagrant ssh authentication failure

The problem with ssh authentication: ==> default: Clearing any previously set forwarded ports... ==> default: Clearing any previously set network interfaces... ==> default: Preparing network interfaces based on configuration... default: Adapter…
ic3b3rg
  • 14,629
  • 4
  • 30
  • 53
171
votes
3 answers

Use PPK file in Mac Terminal to connect to remote connection over SSH

I have been using Putty on Windows XP and used the .ppk file to connect to my Linux servers (several servers). On the servers I have the following folder and file ~/.ssh/authorized_keys I now want to use a Mac to connect via the terminal. I have set…
Anand
  • 4,182
  • 6
  • 42
  • 54