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
74
votes
6 answers

.ssh/config file for windows (git)

I've been looking for a solution on how I can use multiple ssh keys and I figured out, that it will work with a config file in the .ssh directory, but it doesn't work on windows. My problem is that I'm using a private key to access a git server, so…
mathew11
  • 3,382
  • 3
  • 25
  • 32
74
votes
5 answers

How to forward local keypair in a SSH session?

I manually deploy websites through SSH, I manage source code in github/bitbucket. For every new site I'm currently generating a new keypair on the server and adding it to github/bitbucket, so that I can pull chances from server. I came across a…
Sathish Manohar
  • 5,859
  • 10
  • 37
  • 47
73
votes
16 answers

How can I fix "kex_exchange_identification: read: Connection reset by peer"?

I want to copy data with scp in a GitLab pipeline using PRIVATE_KEY. The error is: kex_exchange_identification: read: Connection reset by peer Connection reset by x.x.x.x port 22 lost connection Pipeline log: $ mkdir -p ~/.ssh $ echo…
Mohammad Reza Mousavi
  • 894
  • 1
  • 10
  • 18
73
votes
8 answers

How to access SSH keys for a Google Cloud Platform Compute Engine VM instance?

I created a new instance via the Google Cloud web console from a CentOS 6.x image. I saw a blank on the creation form where I could paste in an existing SSH key; since this was my first instance, I didn't have one yet. I assumed it would take me…
73
votes
4 answers

SSH Agent Forwarding with Ansible

I’m using Ansible 1.5.3 and Git with ssh agent forwarding (https://help.github.com/articles/using-ssh-agent-forwarding). I can log into the server that I am managing with Ansible and test that my connection to git is correctly…
Bob Barcklay
  • 1,584
  • 1
  • 15
  • 22
72
votes
11 answers

Why am I getting a "failed to connect to server" message from tmux when I try to list sessions?

Here's what's happening to me: I start tmux sessions using tmux -L name1, tmux -L name2; then I detatch them using ctrl+B+d. Then I try to get a list of the currently running sessions on my computer. However, when I run tmux ls, I get an error…
thinke365
  • 1,305
  • 3
  • 14
  • 22
72
votes
6 answers

cannot pull Git remote repository from Sourcetree

I Generated ssh keys and configured my git and SourceTree. I could git pull and do other operations from Git-bash. Note: I have added the following in .bashrc to make it work. eval `ssh-agent` ssh-add However, when I try to git pull in SourceTree,…
72
votes
3 answers

How to preserve files original creation date?

I'm moving files on the server from one directory to another using the file manager. Is there a way to preserve file creation date/time (when it was first added to server)? Someone suggested SSH, but I'm not very familiar with it. Does anyone have…
Kakenx
  • 1,315
  • 3
  • 18
  • 34
72
votes
3 answers

How to add socks proxy to ssh config file?

I know how to forward SOCKS proxy on the command like below ssh -D port_number user@host This works well but I want to be able to put that forwarding into my SSH config file. But I am not able to locate any useful information or tutorial about. I…
yarun can
  • 2,871
  • 5
  • 25
  • 27
71
votes
9 answers

Use qdel to delete all my jobs at once, not one at a time

This is a rather simple question but I haven't been able to find an answer. I have a large number of jobs running in a cluster (>20) and I'd like to delete them all and start over. According to this site I should be able to just do: qdel -u…
Gabriel
  • 40,504
  • 73
  • 230
  • 404
71
votes
4 answers

JConsole over ssh local port forwarding

I'd like to be able to remotely connect to a Java service that has JMX exposed, however it is blocked by a firewall. I have tried to use ssh local port forwarding, however the connection fails. Looking at wireshark, it appears that when you try to…
blockcipher
  • 2,144
  • 4
  • 22
  • 35
71
votes
8 answers

ssh script returns 255 error

In my code I have the following to run a remote script. ssh root@host.domain.com "sh /home/user/backup_mysql.sh" For some reason it keeps 255'ing on me. Any ideas? I can SSH into the box just fine (passless keys setup) REMOTE SCRIPT: MUSER='root'…
Amanada Smith
  • 1,893
  • 9
  • 28
  • 42
70
votes
10 answers

Avoid gnome-terminal close after script execution?

I created a bash script that opens several gnome-terminals, connect to classroom computers via ssh and run a script. How can I avoid that the gnome-terminal closes after the script is finished? Note that I also want to be able to enter further…
Marten Bauer
  • 3,099
  • 5
  • 22
  • 18
70
votes
2 answers

What is actually in known_hosts?

I did not have an .ssh directory until I ran ssh user@foo.com This created a .ssh directory with one file known_hosts. It had some text like this in it. foo.com,107.180.00.00 ssh-rsa…
cade galt
  • 3,843
  • 8
  • 32
  • 48
70
votes
3 answers

Using putty to scp from windows to Linux

I'm trying to test some C code that I'm writing. The only issue is that the code needs to be executed on a remote machine. My laptop is pretty old, and there is no driver for my wireless card available for Ubuntu, so booting into Linux to…
Chris Phillips
  • 1,997
  • 2
  • 19
  • 34