Questions tagged [ssh]
Secure Shell; a network protocol that allows data transfer over a secure channel between two networked devices.
876
questions
197
votes
10
answers
249k
views
How do I set up SSH so I don't have to type my password?
How do I set up SSH so I don't have to type my password when connecting to a host?
128
votes
8
answers
68k
views
Forward SSH traffic through a middle machine
SSH tunneling is very confusing to me. I am wondering if I can do this in Linux.
I have 3 machines..
A. My local machine at home.
B. Machine at work that I can SSH into (middle man).
C. My desktop ...
476
votes
18
answers
475k
views
An SSH tunnel via multiple hops
Tunneling data over SSH is pretty straight-forward:
ssh -D9999 [email protected]
sets up port 9999 on your localhost as a tunnel to example.com, but I have a more specific need:
I am working ...
107
votes
10
answers
203k
views
UDP traffic through SSH tunnel
The title pretty much sums it up. I would like to send UDP traffic through a SSH tunnel. Specifically, I need to be able to send UDP packets through the tunnel and have the server be able to send ...
352
votes
19
answers
321k
views
How to reliably keep an SSH tunnel open?
I use an SSH tunnel from work to go around various idotic firewalls (it's ok with my boss :)). The problem is, after a while the ssh connection usually hangs, and the tunnel is broken.
If I could at ...
127
votes
5
answers
230k
views
How can I SSH into "Bash on Ubuntu on Windows 10"?
I have Windows 10 Anniversary Edition with "Bash on Ubuntu on Windows" installed and working. I'd like to be able to SSH into this Ubuntu instance, but although I have openssh-server installed and ...
22
votes
1
answer
58k
views
How to create a SOCKS proxy with ssh?
I want to use my computer as a SOCKS proxy. Do you just have to do ssh -D port_number hostname? Do I have to put my Linux username as the hostname?
469
votes
18
answers
880k
views
Windows SSH: Permissions for 'private-key' are too open
I've OpenSSH 7.6 installed in Windows 7 for testing purposes. SSH client & server work just fine till I tried to access one of my AWS EC2 box from this windows.
It seems like I need to change the ...
15
votes
3
answers
3k
views
Leave bash script running on remote terminal while not logged in?
I have a bash script that takes several hours to run. While it's running, I would like to do other things, which may involve logging out or disconnecting from the internet (my script runs network ...
95
votes
12
answers
609k
views
PuTTY Network Error: Software caused connection abort
I have a strange problem: When I'm using PuTTY with SSH connecting to a Linux server hosted in VMware on my local Windows 7, I often get the error saying "Network error: Software caused ...
84
votes
4
answers
263k
views
Create an SSH user who only has permission to access specific folders
I installed SSH, but I found if I use my original account to login to Ubuntu, it has too many permissions.
I want to constrain the user to only have permissions for specific folders in Ubuntu. How ...
30
votes
6
answers
109k
views
Connect to Linux by name rather than IP
I'm new to Linux (currently running Ubuntu 10.04) and I have just finished setting up SSH access to my Linux Machine. Currently, I have to use ssh [email protected] to connect but would much rather be ...
4
votes
1
answer
7k
views
How to execute complex command line over ssh?
I sometimes want to get the env of a docker container running on a remote host. To do this I log into the host:
ssh [email protected]
and then I run this command:
sudo docker exec -it `sudo ...
20
votes
6
answers
56k
views
How to detach ssh session without killing a running process?
I started a test filesystem resize on a server through ssh, but totally forgot to do that on a screen session. Now it is running, and my laptop has very slow internet. Is there any way that I can keep ...
77
votes
9
answers
134k
views
Unable to change file permissions on Ubuntu Bash for Windows 10
I was trying to use an ssh instance and I received the following error, which is odd since I tried to change the permission using chmod, but that didn't seem to work as permissions were still 777:
@@@@...
56
votes
1
answer
32k
views
Does the right half of the rsa public key matter?
In a public key file "id_rsa.pub" generated by ssh-keygen, does the part after the == matter?
I ask because when I changed "[email protected]" to "root", it seems to still work.
More generally, I ...
47
votes
3
answers
208k
views
How to run a remote command in PuTTY after login & keep the shell running?
What I'm trying to do: start a PuTTY session from the command line, login to remote machine and cd to provided directory.
putty.exe -agent -ssh some.host
That will open a session & login with my ...
46
votes
2
answers
71k
views
Can I create an SSH user which can access only certain directory?
I have a Virtual Private Server which I can connect to using SSH with my root account, being able to execute any linux command and access all the disk area, obviously.
I would like to create another ...
13
votes
3
answers
33k
views
SSH into WSL from another machine on the network
I'm trying to deploy a distributed systems using Windows machines. However, the code I want to compile and run on this system should get complied in a Linux-based environment. Thus, I downloaded and ...
7
votes
1
answer
12k
views
Copy file using scp fails (debug1: Exit status -1)
I wanted to copy a single file from a remote server to my local machine.
I do not have root privileges on the remote machine but I can successfully SSH into a user given the password.
However the ...
1
vote
2
answers
7k
views
How can I execute a command on a remote server through scp?
When using ssh to access raspberry pi running balenaos, ssh -t -p 22222 root@device-ip "balena-engine exec -it <container_name> /bin/sh" grants me access to a specific container inside ...
191
votes
16
answers
1.9m
views
How do I fix a "cannot open display" error when opening an X program after ssh'ing with X11 forwarding enabled?
After launching the X11 app (XQuartz 2.3.6, xorg-server 1.4.2-apple56) on my Mac (OS X 10.6.8), opening an terminal in X11 and running xhost +, I then ssh -Y to my Ubuntu 10.04 VM (running on VMware ...
99
votes
4
answers
55k
views
Are GPG and SSH keys interchangable?
I want to generate an RSA key in GPG and use it in SSH login. Is this even possible? If so, how?
edit: see @wwerner's answer, I didn't try it but it seems to be the current solution (as of 2018)
6
votes
1
answer
7k
views
Accessing localhost web server via reverse SSH tunnel and URL
I have a web server running on a local machine and it is easily accessible to all machines on the LAN. I also have a remote server with a public IP address/URL pointing to it (example.com). I cannot ...
3
votes
2
answers
4k
views
SSH disable port forward remotely instead of killing process on the server
I am making an automatic remote SSH port forward request from my device every few minutes:
ssh -y -f -N -R port:localhost:22 user@server \
-o ExitOnForwardFailure=yes -o ServerAliveInterval=60 \
-o ...
0
votes
3
answers
2k
views
Move all files in local directory to remote SFTP directory
I want to move all files in local directory to remote directory.
And I am using this code to achieve it
SOURCE_FILE=/var/www/oneserver/*
TARGET_DIR=/var/www/anotherServer
ARCHIEVEFILE=/var/www/...
252
votes
8
answers
207k
views
How to make an SSH tunnel publicly accessible?
Referring back to this question, I am executing the below via OpenSSH (Client: Mac OS X 10.6 | Server: Linux Mint), however the port that is being tunneled is not working publicly:
ssh -R 8080:...
163
votes
10
answers
195k
views
How to use Mac OS X Keychain with SSH keys?
I understand that since Mac OS X Leopard the Keychain has supported storing SSH keys. Could someone please explain how this feature is supposed to work.
I have some RSA keys that I've generated ...
157
votes
7
answers
276k
views
How can I tunnel all of my network traffic through SSH?
Whenever I'm using the internet from an insecure location (such as public wifi) I like to use an ssh tunnel (ssh -D port host) to ensure my traffic can't be sniffed. Unfortunately, there seem to be ...
61
votes
2
answers
64k
views
ssh -o PreferredAuthentications: What's the difference between "password" and "keyboard-interactive"?
Both PreferredAuthentications=password and PreferredAuthentications=keyboard-interactive would prompt for the password, so what's the difference between them?
I Google'd with the keywords ssh ...
44
votes
3
answers
76k
views
How can I use ssh to run a command on a remote Unix machine and exit before the command completes?
How can I use ssh to run a command on a Unix machine and exit before the command completes?
For instance, if I type
ssh localhost 'sleep 60 &'
ssh hangs on my terminal until sleep completes, ...
21
votes
3
answers
49k
views
How to connect to Windows subsystem for Linux from another machine within network?
I set up my Ubuntu WSL instance and am running an SSH server on it. However, when I do ifconfig on the Ubuntu console, my Ipv4 is 172.26.66.223, which is different from my regular machine's ipv4 192....
16
votes
3
answers
19k
views
SFTP over double server hop
I'm trying to work out a method to allow me to access files on an SFTP server than I cannot access from my local machine. Currently, I have to SSH to a remote server (it is in a certain IP block that ...
5
votes
1
answer
6k
views
How/why does ssh output to tty when both stdout and stderr are redirected?
I've just noticed that
ssh user@host >/tmp/out 2>/tmp/err
can write something like
Warning the RAS host key...
...
Are you sure you want to continue connecting (yes/no)?
stdout and stderr ...
1154
votes
25
answers
1.5m
views
How to tell git which private key to use?
ssh has the -i option to tell which private key file to use when authenticating:
-i identity_fileSelects a file from which
the identity (private key) for RSA or DSA authentication is read.
The ...
253
votes
4
answers
460k
views
How to convert .ppk key to OpenSSH key under Linux?
I know that is possible to convert .ppk under puttygen in Windows, but how to do that on Linux? Is this possible ?
151
votes
9
answers
240k
views
How do I make Bash my default shell on Ubuntu?
I have a .bash_profile in my home directory, but it isn't getting run on login. If I do the following, then things seem to be as I expect:
ssh myhost
bash
source ~/.bash_profile
But normally that ...
142
votes
24
answers
247k
views
Why is my SSH login slow?
I'm seeing delays in SSH Logins. Specifically, there are 2 spots where I see a range from instantaneous to multi-second delays.
Between issuing the ssh command and getting a login prompt and
between ...
131
votes
15
answers
154k
views
How to force GPG to use console-mode pinentry to prompt for passwords?
Using gpg from a console-based environment such as ssh sessions fails because the GTK pinentry dialog cannot be shown in a SSH session.
I tried unset DISPLAY but it did not help. The GPG command line ...
80
votes
20
answers
61k
views
Sharing the same `ssh-agent` among multiple login sessions
Is there a convenient way to ensure that all logins from a given user (ie me) use the same ssh-agent? I hacked out a script to make this work most of the time, but I suspected all along that there ...
56
votes
5
answers
57k
views
Rsync files via intermediate host
I am currently away from my LAN and I need to do a backup of my laptop. I have a somewhat recent copy of my laptop on my server and I usually back the laptop up using rsync. Now I wish to do that, but ...
45
votes
5
answers
54k
views
SSH access to office host behind NAT router
I would like to access the ssh port of my office linux host from home. Unfortunately the host is located behind a NAT router. So, the IP address is not publicly available. There is however access to ...
24
votes
1
answer
10k
views
Using the IdentityFile directive in ssh_config when AgentForwarding is in use
Is it possible to specify forwarded keys using the IdentityFile directive in .ssh/config?
I ran into this quirk when trying to deploy some code via Capistrano/GIT on our production server. Both my ...
19
votes
6
answers
53k
views
Command to copy client public key to Windows OpenSSH SFTP/SSH server authorized keys file
I have a Linux machine, and I need to sftp to a Windows SFTP server. So for first step, I create my own id_rsa file and the id_rsa.pub in my Linux machine.
Then I copy the text in the id_rsa.pub into ...
18
votes
1
answer
23k
views
How to check if your ssh keys are in the ssh-rsa2 format?
So recently there were news of OpenSSH dropping support for SHA-1 logins and I am trying to understand which format they are referring to. Since years i've been generating keys via ssh-keygen -t rsa -...
15
votes
8
answers
23k
views
Windows SSH Servers?
I was wondering what people use as an SSHd server on Windows? I've decided that I want to be able to log in using SSH on my Windows computers but I don't want to use Linux full-time. What are my ...
14
votes
3
answers
26k
views
Logging into Windows 10 OpenSSH server with Administrator account and public key
I am unable to log into a Windows 10 OpenSSH Server from a CentOS OpenSSH client via public key. My password is always requested (and is accepted).
I've found many posts about setting the permissions ...
4
votes
1
answer
36k
views
How to type commands in PuTTY by creating batch file?
I have created a .bat file which automatically takes the SSH server (Jump Server) access. Now, I have couple of commands which I would like to hit in that window.
For an ex. (To take root access)
...
4
votes
2
answers
3k
views
Does OpenSSH support multihop login?
Ansible uses OpenSSH as the bottomed network communicative implementation, but does it support multi-hop login?
I mean, if Ansible can login a server directly, but can it log in server_a then from ...
4
votes
1
answer
1k
views
Remote code execution after tmux reboot
I've read about tmux-resurrect, but it's still not clear to me if I can do the following:
start tmux session
ssh to remote server
launch long-running code on remote host
kill tmux server (e.g. local ...