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
153
votes
1 answer

What is Pseudo TTY-Allocation? (SSH and Github)

I was trying to setup an SSH connection with Github following this tutorial: Testing your SSH connection I came across the following command: $ ssh -T git@github.com # Attempts to ssh to github Curious, I looked at the ssh manual. It said the…
user2316667
  • 5,444
  • 13
  • 49
  • 71
148
votes
34 answers

Git Remote: Error: fatal: protocol error: bad line length character: Unab

I set up a git server and want now to push initially my repo from the client. I used git push origin master and get this error message: fatal: protocol error: bad line length character: Unab I don't know what's wrong. I don't know what "Unab" is. I…
user437899
  • 8,879
  • 13
  • 51
  • 71
148
votes
14 answers

Heroku 'Permission denied (publickey) fatal: Could not read from remote repository' woes

I've searched around for many hours on end looking to a solution to my seemingly easy-to-fix problem. It's not that my search turned up nothing, it's that my search turned up so many different solutions -none of which have worked. Anyways, I am…
thebradbain
  • 3,139
  • 4
  • 16
  • 17
147
votes
6 answers

Checkout Jenkins Pipeline Git SCM with credentials?

I was following this tutorial: node { git url: 'https://github.com/joe_user/simple-maven-project-with-tests.git' ... } However it doesn't tell how to add credentials. Jenkins does have specific "Credentials" section where you define user…
Render
  • 2,199
  • 2
  • 16
  • 14
147
votes
9 answers

Unable to negotiate with XX.XXX.XX.XX: no matching host key type found. Their offer: ssh-dss

I am trying to create a git repository on my web host and clone it on my computer. Here's what I did: I created a repository on the remote server. I generated a key pair: ssh-keygen -t dsa. I added my key to ssh-agent. I copied to the server public…
Nikita Gorshkov
  • 1,637
  • 2
  • 12
  • 20
146
votes
6 answers

Using the same deploy key for multiple github projects

Github does not allow the same ssh deploy key to be used for more than one project, which would be very useful in some cases (e.g. CI server dealing with project with private sub-modules). I've seen various threads that seem to say that this…
David Ebbo
  • 42,443
  • 8
  • 103
  • 117
145
votes
15 answers

key_load_public: invalid format

I used PuTTY Key Generator to generate a 4096 bit RSA-2 key with a passphrase. I save the .ppk and an openSSL format public key. The putty format public key doesn't work. In any case, my error is as follows: $ ssh -T git@github.com key_load_public:…
JordanGS
  • 3,966
  • 5
  • 16
  • 21
145
votes
14 answers

How to automatically start tmux on SSH session?

I have ten or so servers that I connect to with SSH on a regular basis. Each has an entry in my local computer's ~/.ssh/config file. To avoid losing control of my running process when my Internet connection inevitably drops, I always work inside a…
Alex Ryan
  • 2,427
  • 2
  • 18
  • 15
145
votes
8 answers

Emacs bulk indent for Python

Working with Python in Emacs if I want to add a try/except to a block of code, I often find that I am having to indent the whole block, line by line. In Emacs, how do you indent the whole block at once. I am not an experienced Emacs user, but just…
Vernon
  • 2,703
  • 2
  • 24
  • 30
144
votes
15 answers

How to pass password automatically for rsync SSH command?

I need to do rsync by ssh and want to do it automatically without the need of passing password for ssh manually.
liysd
  • 4,413
  • 13
  • 35
  • 38
143
votes
8 answers

Passing ssh options to git clone

I'm trying to run git clone without ssh checking the repository host's key. I can do it from ssh like that: ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no user@host Is there any way to pass the same ssh options to the git clone…
Daniel
  • 26,899
  • 12
  • 60
  • 88
143
votes
14 answers

How to copy a file to a remote server in Python using SCP or SSH?

I have a text file on my local machine that is generated by a daily Python script run in cron. I would like to add a bit of code to have that file sent securely to my server over SSH.
Alok
  • 1,441
  • 2
  • 10
  • 4
142
votes
30 answers

Possible reasons for timeout when trying to access EC2 instance

I cannot SSH into my instance - Operation timed out. What could be the reasons why, and what can I do to resolve it? Rebooting normally takes a long time to take effect, and might just makes things worst UPDATE: It is not about permissions - i can…
meow
  • 27,476
  • 33
  • 116
  • 177
142
votes
4 answers

git produces Gtk-WARNING: cannot open display

I've been working on my project remotely through the command line on a machine to which I don't have admin rights and after running git push origin master I get the following error message: (gnome-ssh-askpass:29241): Gtk-WARNING **: cannot open…
John Manak
  • 13,328
  • 29
  • 78
  • 119
140
votes
5 answers

Openssh Private Key to RSA Private Key

(I am using MAC) My id_rsa starts with -----BEGIN OPENSSH PRIVATE KEY----- but I expect it to starts with -----BEGIN RSA PRIVATE KEY----- I have send my id_rsa.pub to server administrator to get the access to server, so I don't want to generate a…
Eleanor
  • 2,647
  • 5
  • 18
  • 30