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
95
votes
24 answers

EC2 ssh Permission denied (publickey,gssapi-keyex,gssapi-with-mic)

I got this permission denied problem when I want to ssh to my ec2 host. I tried existing solution chmod 600 "My.pem" but still didn't work. Here is my debug information: debug1: Reading configuration data /etc/ssh/ssh_config debug1:…
lawzlo
  • 983
  • 1
  • 6
  • 8
94
votes
2 answers

How do I close a frozen SSH session?

Sometimes an SSH session to a remote server will freeze indefinitely due to bad internet connectivity. Is it possible to close the session without closing the terminal?
Jian
  • 10,320
  • 7
  • 38
  • 43
94
votes
7 answers

OpenShift rhc setup using multiple accounts

I have two accounts on Openshift platform. How can I setup my computer so that I can manage both of them with rhc? I cannot find any relevant option in the command line arguments.
lunr
  • 5,159
  • 4
  • 31
  • 47
93
votes
6 answers

How do I open port 22 in OS X 10.6.7

I am trying to open port 22 on osx so I can connect to localhost using ssh. This is my current situation: ssh localhost ssh: connect to host localhost port 22: Connection refused I have generated a key and tossed it into my authorized_keys file…
David Erwin
  • 1,270
  • 2
  • 11
  • 14
93
votes
33 answers

ssh : Permission denied (publickey,gssapi-with-mic)

i'm use centos 5.9. after installing gitlab by this link ssh not working. before install gitlab ssh correctly working. i'm using this server localy and other services such as elastix and apache,mysql installed on server. appeare this error…
ali moradi
  • 1,103
  • 1
  • 8
  • 9
92
votes
6 answers

Can someone explain SSH tunnel in a simple way?

Although I use some alias to do ssh tunnel or reverse tunnel, I never understand how it works. Does somebody know how to explain it in very simple way? I think the 3 primary uses are: First of all, I can use my home computer to ssh to…
nonopolarity
  • 146,324
  • 131
  • 460
  • 740
89
votes
6 answers

Amazon EC2 ssh timeout due inactivity

I am able to issue commands to my EC2 instances via SSH and these commands logs answers which I'm supposed to keep watching for a long time. The bad thing is that SSH command is closed after some time due to my inactivity and I'm no longer able to…
Roberto
  • 11,557
  • 16
  • 54
  • 68
89
votes
5 answers

How to change a connection to GitHub from SSH to HTTPS?

I created my first repository in GitHub yesterday. When making the connection I used SSH instead of HTTPS, so I went through a little painful SSH key creation and connection process. At some point I got stuck and the connection failed. I wondered at…
dickbarba
  • 901
  • 1
  • 6
  • 5
89
votes
2 answers

How to enter ssh password using bash?

Everyday I am connecting to a server through ssh. I go through this routine: IC001:Desktop user$ ssh user@my.server.com user@my.server.com's password: Last login: Tue Jun 4 10:09:01 2013 from 0.0.0.0 $ I would like to automate this process and…
Prostak
  • 3,565
  • 7
  • 35
  • 46
88
votes
2 answers

How can I run git push/pull commands with SSH verbose mode?

If I run "git push" with the GIT_TRACE=2 environment variable, I get the following: 09:25:28.098743 git.c:349 trace: built-in: git 'push' 'origin' 'master' 09:25:28.100261 run-command.c:341 trace: run_command: 'ssh'…
Kevin Burke
  • 61,194
  • 76
  • 188
  • 305
88
votes
12 answers

What is the simplest way to SSH using Python?

How can I simply SSH to a remote server from a local Python (3.0) script, supply a login/password, execute a command and print the output to the Python console? I would rather not use any large external library or install anything on the remote…
Christopher Tokar
  • 11,644
  • 9
  • 38
  • 56
87
votes
32 answers

VScode remote connection error: The process tried to write to a nonexistent pipe

I use vscode with remote-ssh to connect my server, after configuring, I want to connect my host, but it failed, the dialog box display:"could not establish connection to XX, The process tried to write to a nonexistent pipe." output: [16:45:20.916]…
douyu
  • 2,377
  • 2
  • 14
  • 27
87
votes
10 answers

SCP doesn't work when echo in .bashrc?

I have two users in Fedora: Wani root (quite obvious!) My contents of .bashrc of user Wani are: # .bashrc echo "Hello" # Source global definitions if [ -f /etc/bashrc ]; then . /etc/bashrc fi # User specific aliases and functions Now after…
Nehal J Wani
  • 16,071
  • 3
  • 64
  • 89
86
votes
9 answers

How to download a file from my server using SSH (using PuTTY on Windows)

When I try downloading a file from my server onto my computer, it actually downloads the file onto the server. (Note I am already SSH'd into my server before typing this command. I've watched tutorials on YouTube and people are using their terminal…
SobieSki
  • 899
  • 1
  • 6
  • 5
85
votes
14 answers

How to check if ssh-agent is already running in bash?

I have a sample sh script on my Linux environment, which basically run's the ssh-agent for the current shell, adds a key to it and runs two git commands: #!/bin/bash eval "$(ssh-agent -s)" ssh-add /home/duvdevan/.ssh/id_rsa git -C…
Zlatan Omerović
  • 3,863
  • 4
  • 39
  • 67