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
253
votes
25 answers

SSH Private Key Permissions using Git GUI or ssh-keygen are too open

Recently I've been unable to clone or push to github, and I'm trying to find the root cause. This is on windows I have cygwin + git as well as msysgit. Msysgit was installed with the following options: OpenSSH Use Git from Windows Command…
Ben Scheirman
  • 40,531
  • 21
  • 102
  • 137
251
votes
14 answers

WARNING: UNPROTECTED PRIVATE KEY FILE! when trying to SSH into Amazon EC2 Instance

I'm working to set up Panda on an Amazon EC2 instance. I set up my account and tools last night and had no problem using SSH to interact with my own personal instance, but right now I'm not being allowed permission into Panda's EC2 instance. Getting…
btw
  • 7,006
  • 9
  • 40
  • 40
251
votes
15 answers

How to use Sublime over SSH

I'm trying to use Sublime Text 2 as an editor when I SSH in to my work server, and I'm stumped. I found this http://urbangiraffe.com/2011/08/13/remote-editing-with-sublime-text-2/ (among many other posts) that looks like it might help, but I don't…
thumbtackthief
  • 6,093
  • 10
  • 41
  • 87
242
votes
17 answers

Git on Bitbucket: Always asked for password, even after uploading my public SSH key

I uploaded my ~/.ssh/id_rsa.pub to Bitbucket's SSH keys as explained, but Git still asks me for my password at every operation (such as git pull). Did I miss something? It is a private repository (fork of another person's private repository) and I…
Nicolas Raoul
  • 58,567
  • 58
  • 222
  • 373
242
votes
14 answers

ssh -L forward multiple ports

I'm currently running a bunch of: sudo ssh -L PORT:IP:PORT root@IP where IP is the target of a secured machine, and PORT represents the ports I'm forwarding. This is because I use a lot of applications which I cannot access without this forwarding.…
PascalVKooten
  • 20,643
  • 17
  • 103
  • 160
240
votes
14 answers

How to ignore ansible SSH authenticity checking?

Is there a way to ignore the SSH authenticity checking made by Ansible? For example when I've just setup a new server I have to answer yes to this question: GATHERING FACTS *************************************************************** The…
Johan
  • 37,479
  • 32
  • 149
  • 237
235
votes
25 answers

Seeing escape characters when pressing the arrow keys in python shell

In shells like the interactive python shell, you can usually use the arrow keys to move around in the current line or get previous commands (with arrow-up) etc. But after I ssh into another machine and start python there, I get sessions like: >>>…
Frank
  • 64,140
  • 93
  • 237
  • 324
231
votes
3 answers

Run ssh and immediately execute command

I'm trying to find UNIX or bash command to run a command after connecting to an ssh server. For example: ssh name@ip "tmux list-sessions" The above code works, it lists the sessions, but it then immediately disconnects. Putting it in the sshrc on…
cadlac
  • 2,802
  • 3
  • 18
  • 34
228
votes
7 answers

Extract public/private key from PKCS12 file for later use in SSH-PK-Authentication

I want to extract the public and private key from my PKCS#12 file for later use in SSH-Public-Key-Authentication. Right now, I'm generating keys via ssh-keygen which I put into .ssh/authorized_key, respective somewhere on the client-side. In…
lazydaemon
  • 2,429
  • 2
  • 17
  • 12
227
votes
10 answers

Git clone / pull continually freezing at "Store key in cache?"

I'm attempting to clone a repo from my BitBucket account to my Windows 10 laptop (running GitBash). I've completed all of the steps necessary to connect (set up my SSH key, verified by successfully SSHing git@bitbucket.org, etc). However, whenever I…
MarathonStudios
  • 2,849
  • 4
  • 20
  • 18
224
votes
14 answers

Why git can't remember my passphrase under Windows

I have just start using git and i can't get it to remember my passphrase I'm using cmd.exe elevated and my git host is github and i have create a ssh key like that guide on github but i still get *\subnus.mvc>git push origin master Enter…
Nesizer
  • 3,074
  • 6
  • 22
  • 25
223
votes
16 answers

Git says "Warning: Permanently added to the list of known hosts"

Every time I use git to interact with a remote, such as when pulling or pushing, I am shown the following message: Warning: Permanently added '...' (RSA) to the list of known hosts. How can I prevent this annoying message from displaying? It is…
Donald T
  • 10,234
  • 17
  • 63
  • 91
222
votes
12 answers

How to run the sftp command with a password from Bash script?

I need to transfer a log file to a remote host using sftp from a Linux host. I have been provided credentials for the same from my operations group. However, since I don't have control over other host, I cannot generate and share RSA keys with the…
anubhava
  • 761,203
  • 64
  • 569
  • 643
220
votes
14 answers

Configuring Git over SSH to login once

I have cloned my git repository over ssh. So, each time I communicate with the origin master by pushing or pulling, I have to reenter my password. How can I configure git so that I do not need to enter my password multiple times?
reprogrammer
  • 14,298
  • 16
  • 57
  • 93
219
votes
5 answers

Git on custom SSH port

My VPS provider recommends that I leave my SSH port to the custom port number they assign it by default (not 22). The thing is, while I know I can provide the port number when creating a remote config, it seems I can't do the same when doing a Git…
ryanzec
  • 27,284
  • 38
  • 112
  • 169