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

Git submodules and ssh access

I have some trouble with a git repository that contains several submodules. The super git repository was constructed with the commands mkdir projectname cd projectname git init git submodule add ssh://myusername@server/pathtorepos When a different…
midtiby
  • 14,550
  • 6
  • 34
  • 43
79
votes
11 answers

Matplotlib: display plot on a remote machine

I have a python code doing some calculation on a remote machine, named A. I connect on A via ssh from a machine named B. Is there a way to display the figure on machine B?
Mermoz
  • 14,898
  • 17
  • 60
  • 85
79
votes
2 answers

PostgreSQL via SSH Tunnel

I'd like to use RazorSQL to connect to my database which is running on a remote server. I create a SSH tunnel on my localhost with the following command: ssh -L 1111:remote.server.com:5432 myuser@remote.server.com I configure my connection via…
kozooh
  • 2,035
  • 1
  • 21
  • 31
79
votes
5 answers

Rsync to Amazon Ec2 Instance

I have an EC2 instance running and I am able to SSH into it. However, when I try to rsync, it gives me the error Permission denied (publickey). The command I'm using is: rsync -avL --progress -e ssh -i ~/mykeypair.pem ~/Sites/my_site/*…
a53-416
  • 3,585
  • 6
  • 34
  • 44
79
votes
3 answers

Permission denied (publickey,keyboard-interactive)

I tried to connect to planetlab node using ssh. It throws me error like Permission denied (publickey,keyboard-interactive). What does this mean? Here is the verbose of the exception. > OpenSSH_5.1p1 Debian-5ubuntu1, OpenSSL > 0.9.8g 19 Oct 2007…
Progress Programmer
  • 7,076
  • 14
  • 49
  • 54
79
votes
6 answers

How to run a script file remotely using SSH

I want to run a script remotely. But the system doesn't recognize the path. It complains that "no such file or directory". Am I using it right? ssh kev@server1 `./test/foo.sh`
Progress Programmer
  • 7,076
  • 14
  • 49
  • 54
78
votes
16 answers

Amazon EC2 Permission denied (publickey)

This seems to be a common problem but my specific case seems a little different. I set up a new Amazon EC2 instance using the command line tools and connected via SSH and did some configuration work. Initially, though, I couldn't ssh on to the…
Trevor
  • 1,619
  • 1
  • 12
  • 7
78
votes
9 answers

Warning: Permanently added the RSA host key for IP address

When I do pull from Github, I am getting this warning message. MYPC:/Rails$ git pull origin master Warning: Permanently added the RSA host key for IP address '#{Some IP address}' to the list of known hosts. From…
Ashwini
  • 2,449
  • 2
  • 29
  • 42
78
votes
11 answers

AWS EC2 Connection closed by when trying ssh into instance

Recently I set up a new EC2 instance. The next day I was not able to connect to my instance via ssh. I could connect and disconnect the day before, I am sure I did nothing. Here is ssh debug info: ssh -i webserver.pem -v…
77
votes
4 answers

How to save ssh password to vscode?

I am using vscode to connect to a remote host. I use Remote-SSH (ms-vscode-remote.remote-ssh) extension to do so. Every time I want to connect to the remote host, I need to enter the password. Is there a way to save the ssh password to vscode?
Mayank Kumar Chaudhari
  • 16,027
  • 10
  • 55
  • 122
76
votes
4 answers

How to ssh connect through Python Paramiko with ppk public key

I'm using Paramiko to connect through SSH to a server. Basic authentication works well, but I can't understand how to connect with public key. When I connect with PuTTY, the server tell me this: Using username "root". Authenticating with public key…
apelliciari
  • 8,241
  • 9
  • 57
  • 92
76
votes
7 answers

What are some good SSH Servers for windows?

Trying to setup an SSH server on Windows Server 2003. What are some good ones? Preferably open source. I plan on using WinSCP as a client so a server which supports the advanced features implemented by that client would be great.
Dane O'Connor
  • 75,180
  • 37
  • 119
  • 173
75
votes
3 answers

Displaying output of a remote command with Ansible

In an Ansible role I generate the user's SSH key. After that I want to print it to the screen and pause so the user can copy and paste it somewhere else. So far I have something like this: - name: Generate SSH keys for vagrant user user:…
Damian Moore
  • 1,306
  • 1
  • 11
  • 13
74
votes
16 answers

Cygwin/Git error cygheap base mismatch detected

I have installed two Windows servers with the latest versions of Cygwin and Git, and I am trying to clone the git repository from S1 to S2. I can successfully ssh from S2 to S1 using RSA keys, but when I do this : git clone…
John Zumbrum
  • 2,786
  • 8
  • 36
  • 60
74
votes
6 answers

How To Execute SSH Commands Via PHP

I am looking to SSH out via PHP. What is the best/most secure way to go about this? I know I can do: shell_exec("SSH user@host.com mkdir /testing"); Anything better? That feels so 'naughty' :).
Justin
  • 42,716
  • 77
  • 201
  • 296