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
109
votes
12 answers

vagrant login as root by default

Problem: frequently the first command I type to my boxes is su -. Question: how do I make vagrant ssh use the root user by default? Version: vagrant 1.6.5
Mike D
  • 5,984
  • 4
  • 31
  • 31
109
votes
6 answers

How to execute a remote command over ssh with arguments?

In my .bashrc I define a function which I can use on the command line later: function mycommand() { ssh user@123.456.789.0 cd testdir;./test.sh "$1" } When using this command, just the cd command is executed on the remote host; the test.sh…
Alex
  • 41,580
  • 88
  • 260
  • 469
109
votes
7 answers

Execute ssh with password authentication via windows command prompt

I need to execute ssh from windows command line by providing password in a non interactive manner. I could implement the key based authentication and able to execute the ssh commands just like ssh @ Is there any commands like…
Balachandar
  • 1,538
  • 3
  • 16
  • 25
109
votes
14 answers

'ssh-keygen' is not recognized as an internal or external command

I run git push -u origin master It tells me that "Permission denied (public key) fatal: The remote end hung up unexpectedly" Then I looked up on the internet and found that I had to generate an ssh key for my account on GitHub. However, upon doing…
user1567909
  • 1,450
  • 2
  • 14
  • 24
108
votes
7 answers

Git Bash: Could not open a connection to your authentication agent

I'm new to Github and Generating SSH Keys look a neccessity. And was informed by my boss about this, so I need to comply. I successfully created SSH Key but when I'm going to add it to the ssh-agent this is what happens What seems to be the…
leipzy
  • 11,676
  • 6
  • 19
  • 24
107
votes
9 answers

Verify host key with pysftp

I am writing a program using pysftp, and it wants to verify the SSH host Key against C:\Users\JohnCalvin\.ssh\known_hosts. Using PuTTY, the terminal program is saving it to the Registry [HKEY_CURRENT_USER\Software\SimonTatham\PuTTY\SshHostKeys]. How…
Gabriel Theodoulos
  • 1,189
  • 2
  • 8
  • 5
107
votes
18 answers

github: No supported authentication methods available

i use github and have successfully added and synched files on my laptop in the past. as of recent i started getting "PuTTY Fatal Error: Disconnected: No supported authentication methods available" after running: git pull origin master (or…
Sonic Soul
  • 23,855
  • 37
  • 130
  • 196
107
votes
13 answers

How do I add my own public key to Vagrant VM?

I got a problem with adding an ssh key to a Vagrant VM. Basically the setup that I have here works fine. Once the VMs are created, I can access them via vagrant ssh, the user "vagrant" exists and there's an ssh key for this user in the…
tehK
  • 2,265
  • 4
  • 17
  • 16
107
votes
5 answers

What's the difference between id_rsa.pub and id_dsa.pub?

Is one more secure than the other?
Andrew
  • 1,071
  • 2
  • 8
  • 3
107
votes
38 answers

Putty: Getting Server refused our key Error

I created key pair using puttygen.exe (client is windows 8). On server (Ubuntu 12.04.3 LTS), I have put my public key in ~/.ssh/authorized_keys. The public key is this: ssh-rsa…
PawelRoman
  • 6,122
  • 5
  • 30
  • 40
106
votes
7 answers

SVN+SSH, not having to do ssh-add every time? (Mac OS)

I know the answer is out there, but I'm pretty Unix-dumb and probably wouldn't recognize the solution if it hit me in the face. I'm on a Mac, connecting to a SVN server via SSH tunneling. I have to ssh-add privateKey.txt every time I want to…
James J
  • 6,428
  • 6
  • 35
  • 45
106
votes
10 answers

Hook up Raspberry Pi via Ethernet to laptop without router?

I'm working on a balloon project with a Raspberry Pi. When we potentially recover the Raspberry Pi, it will most likely be in a rural location and I'd like to turn off the Pi at that point safely. Without a router or network nearby, I was wondering…
user2170780
  • 1,189
  • 4
  • 10
  • 7
106
votes
8 answers

Using a socks proxy with git for the http transport

How to make git use a socks proxy for HTTP transport? I succeed in configuring git with GIT_PROXY_COMMAND to use a socks proxy for GIT transport. Also, I have configured my .curlrc file to defined the socks proxy and I can fetch information directly…
Yves Blusseau
  • 4,244
  • 4
  • 16
  • 7
105
votes
1 answer

GitHub SSH Config: "Bad configuration option: IdentifyFile"

I'm trying to create a .ssh/config file for multiple SSH accounts (specifically for github.com). I've tried several tutorials and github help walk-throughs but nothing seems to work. I created a id_rsa_test and id_rsa_test.pub. I uploaded…
Rico
  • 5,692
  • 8
  • 46
  • 63
103
votes
9 answers

How to restrict SSH users to a predefined set of commands after login?

This is a idea for a security. Our employees shall have access to some commands on a linux server but not all. They shall e.g. have the possibility to access a log file (less logfile) or start different commands (shutdown.sh / run.sh). Background…
Marcel
  • 3,749
  • 6
  • 29
  • 35