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
332
votes
13 answers

Delete newline in Vim

Is there a way to delete the newline at the end of a line in Vim, so that the next line is appended to the current line? For example: Evaluator(): _bestPos(){ } I'd like to put this all on one line without copying lines and pasting them into…
derekerdmann
  • 17,696
  • 11
  • 76
  • 110
319
votes
14 answers

Multiple GitHub Accounts & SSH Config

I'm having some trouble getting two different SSH keys/GitHub accounts to play well together. I have the following setup: Repos accessible from one account using git@github.com:accountname Repos accessible from another account using…
radesix
  • 5,834
  • 5
  • 24
  • 39
308
votes
20 answers

How to prevent a background process from being stopped after closing SSH client in Linux

I'm working on a Linux machine through SSH (Putty). I need to leave a process running during the night, so I thought I could do that by starting the process in background (with an ampersand at the end of the command) and redirecting stdout to a…
GetFree
  • 40,278
  • 18
  • 77
  • 104
305
votes
25 answers

How to solve "sign_and_send_pubkey: signing failed: agent refused operation"?

Configuring a new Digital Ocean droplet with SSH keys. When I run ssh-copy-id this is what I get: ssh-copy-id user@012.345.67.89 /usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already…
user968270
  • 4,251
  • 5
  • 21
  • 20
303
votes
17 answers

Repository access denied. access via a deployment key is read-only

After successfully cloning my repo from heroku and added another remote 1/ git clone git@heroku.com:[APP].git 2/ git remote add bitbucket ssh://git@bitbucket.org/[ACCOUNT]/[REPO].git 3/ git push bitbucket master I am still getting this error after…
zabumba
  • 12,172
  • 16
  • 72
  • 129
296
votes
25 answers

'heroku' does not appear to be a git repository

When I try to push my app to Heroku I get this response: fatal: 'heroku' does not appear to be a git repository fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists. I have…
Tim
  • 3,191
  • 2
  • 16
  • 22
289
votes
4 answers

How do I add a password to an OpenSSH private key that was generated without a password?

I generated an OpenSSH private key using PuTTYgen (and exported it in OpenSSH format). How can I put a password on this existing key (I know how to generate a new key with a password)?
Conrad
  • 2,891
  • 2
  • 15
  • 3
278
votes
11 answers

Add Keypair to existing EC2 instance

I was given AWS Console access to an account with 2 instances running that I cannot shut down (in production). I would, however, like to gain SSH access to these instances, is it possible to create a new Keypair and apply it to the instances so I…
Chris Wagner
  • 20,773
  • 8
  • 74
  • 95
278
votes
6 answers

Why does an SSH remote command get fewer environment variables then when run manually?

I have a command that runs fine if I ssh to a machine and run it, but fails when I try to run it using a remote ssh command like : ssh user@IP Comparing the output of "env" using both methods resutls in different environments. When I…
Tom Feiner
  • 20,656
  • 20
  • 48
  • 51
274
votes
44 answers

Getting permission denied (public key) on gitlab

My problem is that I can't push or fetch from GitLab. However, I can clone (via HTTP or via SSH). I get this error when I try to push : Permission denied (publickey) fatal : Could not read from remote repository From all the threads I've looked,…
270
votes
2 answers

Is there a way to continue broken scp (secure copy) command process in Linux?

I am copying 7.5 GB file to a remote server using scp command. At some point in time file transfer breaks and I have to start all over again. Is the temporary amount of file being transferred completely lost ? Can I somehow restart the transfer from…
Matko
  • 3,386
  • 4
  • 21
  • 35
270
votes
24 answers

Automatically enter SSH password with script

I need to create a script that automatically inputs a password to OpenSSH ssh client. Let's say I need to SSH into myname@somehost with the password a1234b. I've already tried... #~/bin/myssh.sh ssh myname@somehost a1234b ...but this does not…
user1467855
  • 3,843
  • 7
  • 28
  • 29
263
votes
8 answers

How to set ssh timeout?

I'm executing a script connecting via password-less SSH on a remote host. I want to set a timeout, so that if the remote host is taking an infinite time to run, I want to come out of that ssh session and continue other lines in my sh script. How can…
user57421
  • 7,091
  • 7
  • 25
  • 22
259
votes
17 answers

Github permission denied: ssh add agent has no identities

This is my first time accessing GitHub and I'm not experienced using a console. I am on a MacBook using Bash. When I try to access GitHub, I get this: git clone git@github.com:dhulihan/league-of-legends-data-scraper.git Cloning into…
Dark
  • 2,709
  • 2
  • 11
  • 4
253
votes
9 answers

How can I remove an SSH key?

I currently have an old SSH key uploaded on a server. The problem is I lost my ~/.ssh directory (with the original id_rsa and id_rsa.pub files). Consequently, I want to remove the old SSH key directly on the server and upload a new one. I tried the…
user1364743
  • 5,283
  • 6
  • 51
  • 90