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
10
votes
2 answers

How to automatically start a tunnel when a session is opened in MobaXterm?

I use MobaXterm for remote access to servers running in the cloud. For development and admin purposes, these servers expose admin application on local network interfaces. For example, Tomcat will expose 127.0.0.1/manager. Since I prefer not to have…
Grismar
  • 27,561
  • 4
  • 31
  • 54
10
votes
2 answers

List files on SFTP server matching wildcard in Python using Paramiko

import paramiko client = paramiko.SSHClient() client.set_missing_host_key_policy(paramiko.AutoAddPolicy()) client.connect('hostname', username='test1234', password='test') path = ['/home/test/*.txt', '/home/test1/*.file', '/home/check/*.xml'] for i…
Vijay
  • 133
  • 1
  • 1
  • 10
10
votes
3 answers

Open terminal from html using href ssh:// url with command line options

I'd like to create a url link that launches terminal (from webpage or browser such as chrome or safari) and ssh's to a box and launches remote commands (for example ls), in terminal it would look like: ssh user@1.2.3.4 'ls' I've tried:
hagope
  • 5,523
  • 7
  • 38
  • 52
10
votes
7 answers

Python script - connect to SSH and run command

I already know there are ssh modules for Python, that's not for what I'm looking for. What I want to have is an python script to do the following: > connect to an [ input by user ] SSH host > connect using the credentials [ provided by the user ] >…
Ilias
  • 211
  • 1
  • 2
  • 6
10
votes
1 answer

How to use a private repository in CircleCI?

I am a tester of plugins of Redmine. I want to test all plugins. In order to do so,I set .circleci/config.yml under one plugin's repository (managed by Github) and tried to test. But I got following mistake message. #!/bin/bash -eo pipefail …
hane
  • 101
  • 1
  • 1
  • 5
10
votes
2 answers

Jenkins hangs when trying to fetch from Stash

I am trying to configure Jenkins to work with Atlassian Stash. I have gotten as far as (apparently) getting the Git plugin to successfully ping Stash, as there are no longer any error messages from the Git plugin page. I am using Git with SSH, and…
Tim Biegeleisen
  • 502,043
  • 27
  • 286
  • 360
10
votes
2 answers

Forwarding SIGTERM over ssh

I want ssh to forward the SIGTERM signal to the remote command. ssh root@localhost /root/print-signal.py Get PID of ssh: ps aux| grep print-signal Kill the matching ssh process: kill pid-of-ssh Unfortunately only the ssh process itself gets the…
guettli
  • 25,042
  • 81
  • 346
  • 663
10
votes
3 answers

How to use VPN with Bitbucket Pipelines

I need to access a remote server from Bitbucket Pipelines. This remote server is available only to a specific host which has its IP address whitelisted. Here is what I want: Pipelines <---> The gateway host <---> The remote server I was trying to…
Max Malysh
  • 29,384
  • 19
  • 111
  • 115
10
votes
4 answers

Host Key Verification Failed with sshpass rsync

On my linux server I run the command: sshpass -p 'password' rsync -avz /source/folder/ root@192.168.x.x:/dest/folder When I run the command without sshpass it will provide me with prompts for authenticity of host and the password. I need some…
khm
  • 466
  • 2
  • 4
  • 17
10
votes
1 answer

Setting up SSH keys for github private repo access on Elastic Beanstalk

My Node.JS project contains references to private NPM repos hosted on github. This works fine locally, but I'm struggling to get this working on Elastic Beanstalk. dependencies: { ... "express": "^4.12.4", "jsonwebtoken": "^5.0.5", …
JHH
  • 8,567
  • 8
  • 47
  • 91
10
votes
1 answer

AddKeysToAgent yes ssh config not working on Mac

Hi I have my ssh config file setup to auto add ssh keys to ssh agent. However, currently it is not working. It was working previously. I updated the ssh key for bitbucket and it no longer works. When I reboot, I have to add the ssh key manually…
CodyK
  • 3,426
  • 4
  • 36
  • 52
10
votes
2 answers

SSH key will not permanently add to my keychain

I have tried the following: ssh-add -K ~/.ssh/id_rsa This seems to work until I end my terminal session, but then I get prompted for my passphrase again with a new session. Here is what I see after running the command above: Identity added:…
Abram
  • 39,950
  • 26
  • 134
  • 184
10
votes
1 answer

Clone a secure git repo in Kubernetes pod

I've run into an interesting situation where I need to clone a private github repo into a docker container that I'm running in Kubernetes. Originally I tried using a gitRepo mount, however, having an OAuth key in my deployment manifest is…
3ocene
  • 2,102
  • 1
  • 15
  • 30
10
votes
2 answers

SourceTree terminal automatically load ssh key

There are some tasks that are only possible/easier to do in git bash (or Terminal) than in SourceTree. I have most of my repositories on bitbucket and use ssh key. The problem I have is that even though I load my key with SourceTree (Pageant putty…
rluks
  • 2,762
  • 8
  • 38
  • 56
10
votes
4 answers

Cannot push git to remote repository: (SSH error)

When I attempt to push to my heroku.com remote git repository, i get this message: ssh: connect to host heroku.com port 22: Connection refused I can easily work with my repository on github with the same ssh key. Entering: $ssh git@github.com …
Matt H.
  • 10,438
  • 9
  • 45
  • 62