Secure Shell (SSH) is a protocol primarily for encrypted shell connections. This tag is also used for questions about sshd and openssh, the two standard applications for using SSH.

learn more… | top users | synonyms (2)

19
votes
7answers
4k views

Restart SSH on a machine where SSH is the only mode of access

I've made some changes to sshd_config file and therefore need to restart. I'm looking tips on safely restarting ssh when getting physical access to the server would be a huga PITA.
16
votes
4answers
5k views

Is it possible to get OpenSSH to log the public key that was used in authentication?

I have a production system where several different people are allowed to log in to a single account - the account is for the application and not for the person as we don't have personal accounts on ...
13
votes
3answers
1k views

Inline SSH command

Is it possible to do a simple inline style SSH command, for example: ssh foo@bar.com { cd foo/bar && rm *.foobar }
13
votes
13answers
31k views

Stop ssh login from printing motd from the client?

I've got SSH passwordless set up, however it prints the MoTD when it logs in. Is there anyway to stop that happening from the client side? I've tried ssh -q but that doesn't work. I don't want to use ...
11
votes
4answers
52k views

Free public SSH server for testing purposes [closed]

I'm writing an application that makes connections to SSH servers. It doesn't need anything specific from the server (except running under GNU/Linux). I need SSH servers for running my application ...
9
votes
5answers
7k views

How can I automatically change terminal colors when I ssh a server?

I'm frequently logging into different servers from my os x terminal window. I'd like to assign a color scheme for different hosts so that my terminal windows are easier to tell apart. Can this be ...
8
votes
4answers
6k views

Transfer files via SSH

I want to use file transfer via SSH on some scripts. I've read it's possible to tar over ssh. Where should I start reading?
8
votes
5answers
6k views

Can I create SSH to tunnel HTTP through server like it was proxy?

Say I have a server and client. I need to create connection from client to a website through server like it was proxy. Is it possible to do this using a SSH tunel, or do I have to install some proxy ...
6
votes
1answer
929 views

Adding port forwardings programmatically on a ControlMaster SSH session

I just found out about the ControlMaster/ControlPath feature of OpenSSH, which allows you to use a single SSH connection to run multiple terminals. As I often use SSH to use port forwarding to get ...
5
votes
5answers
6k views

How can I disconnect ssh users, or limit the number of ssh logins?

I have an application that is using ssh to authenticate. Due to a variety of regulations (HIPAA, etc) users can only be logged in for a certain amount of time, and they can only be logged in once. I ...
5
votes
8answers
18k views

Is it possible to prevent SCP while still allowing SSH access?

Using Solaris and Linux servers and OpenSSH, is it possible to prevent users from copying files using "scp" while still allowing shell access with "ssh"? I realize that 'ssh $server "cat file" ' type ...
4
votes
3answers
7k views

How can I enable X11 forwarding to a Debian server box?

I want to connect to a server with SSH (a Debian installation in a VMware image). On that server I want to call gitk a repository viewer for git. What do I need to do to make this work?
2
votes
1answer
3k views

Trying to get SSH with public key (no password) + google authenticator working on Ubuntu 14.04.1

I'm using Ubuntu 14.04.1 (with OpenSSH 6.6 and libpam-google-authenticator 20130529-2). I'm trying to set up SSH logins where the public key authenticates (without a password) and a user is prompted ...
1
vote
2answers
3k views

ssh remote command-fu

I am trying to do a remote backup from behind a firewall. It is really no problem to break this out into its own script that gets called in crontab, but that isn't any fun! What I am trying to do ...
14
votes
3answers
13k views

What options can be put into a SSH authorized_keys file?

I found this article on options that can be put before a key in the authorized_keys file. I was wondering though, are there more? Options listed in the article are from="domain" ...
12
votes
11answers
10k views

Best way to go about changing a root password on 3000+ Solaris, AIX, and Linux servers?

Long story short: Big old corporation, lots of UNIX/Linux servers. I inherited responsibility for a bunch of scripts that that left a few years ago. One of them was a script that would be run every ...
12
votes
2answers
17k views

How to check if a RSA public / private key pair matched

I have two files, id_rsa and id_rsa.pub, what command can be used to validate if they are the valid pair.
9
votes
2answers
5k views

Authentication Order with SSH

i am still have troubles mastering sshd - when I login with -v I see that ssh is authenticating the following way debug1: Authentications that can continue: ...
8
votes
2answers
12k views

SFTP fatal bad ownership or modes for chroot directory ubuntu 12.04

I just set up my SFTP server and it works fine when I use it from my first user account. I wanted to add a user which we will call 'magnarp'. At first I did like this in sshd_config: Subsystem sftp ...
8
votes
1answer
2k views

SSH passphrase remembered in MacOSX Snow Leopard

I am facing a very strange situation with Snow Leopard. I have a Linux server, configured to accept an ssh connection authenticated only through RSA key. No password. On my laptop I correctly deployed ...
7
votes
3answers
2k views

OpenSSH with public keys from database

Is it possible to fetch the public keys from a database instead of the authorized_keys file? I would like to use such a setup to manage ssh access to things like git repositories for multiple users ...
7
votes
6answers
10k views

Can't get detached screen to resume

I use putty and have an unreliable wireless connection, so I use screen to keep my work going. Often I'll get disconnected, and then I can't reattach my screen. I'll run screen -D -RR and it will just ...
6
votes
3answers
2k views

Restricting the network access of Docker container

I'm in the process of creating an SFTP only Docker container, one that will be used by multiple people for the sole purpose of uploading and managing files in their own chrooted Environment. On ...
4
votes
3answers
4k views

Is it possible to connect a EC2 Linux instance via ssh without the key pair?

I can connect to my EC2 Linux instance via ssh using the key pair (*.pem). Is it somehow possible to connect it with ssh with out the pem file?
3
votes
2answers
4k views

How to display SSH banner at login, but only for password authentication

I have a warning message that is displayed to a user after they enter their username to log in to our Linux servers. I only want to display this message for password authentications, and not when ...
2
votes
3answers
3k views

Wordpress can't find ssh public and private key pair

My server configuration is as follows: CentOS 5.8 (final) running Nginx. I am using the SSH2 feature of Wordpress's plugin installer. I have installed lib2ssh and it is working (Wordpress is ...
1
vote
2answers
3k views

How does one determine active SSH and SAMBA connection counts?

I have a server that I use infrequently, so I'd like to cron a job to shutdown daily if no users are logged in via SSH and SAMBA shares. How can I determine how many active SSH connections there are, ...
19
votes
2answers
1k views

Do the SSH or FTP protocols tell the server to which domain I am trying to connect?

When using the ssh or ftp commands from the Bash shell, does the server that I am connecting to learn of the domain name used? I understand that the domain name is locally translated into an IP ...
19
votes
5answers
19k views

Ssh, run a command on login, and then Stay Logged In?

I tried this with expect, but it didn't work: it closed the connection at the end. Can we run a script via ssh which will log into remote machines, run a command, and not disconnect? So ssh in a ...
12
votes
1answer
3k views

Is it possible to run sshd as a normal user?

I'm aiming to start up a second sshd instance on a non-privileged port (e.g. 2222) with my own configuration file. Obviously, the sshd process can't setuid so logging in as users other than the one ...
11
votes
3answers
11k views

Why is ssh agent forwarding not working?

In my own computer, running MacOSX, I have this in ~/.ssh/config Host * ForwardAgent yes Host b1 ForwardAgent yes b1 is a virtual machine running Ubuntu 12.04. I ssh to it like this: ssh pupeno@b1 ...
8
votes
1answer
2k views

Only allow password authentication to SSH server from internal network

I have an OpenSSH 5.9p1 server running on Ubuntu Precise 12.04 which accepts connections from both the internal network and the Internet. I'd like to require public key authentication for connections ...
8
votes
4answers
13k views

In Fail2Ban, How to Change the SSH port number?

In my server, the ssh port is not the standard 22. I have set a different one. If I setup fail2ban, will it be able to detect that port? How can I tell it to check that port rather than port 22? The ...
8
votes
4answers
22k views

SSH X11 not working

I have a home and work computer, the home computer has a static IP address. If I ssh from my work computer to my home computer, the ssh connection works but X11 applications are not displayed. In my ...
7
votes
1answer
688 views

Conditional ProxyCommand in ~/.ssh/config?

I have my ~/.ssh/config configured with various hosts that are accessible either while on our company VPN, or via a SSH proxy server. At the moment I just have Host internal-server ProxyCommand ...
7
votes
4answers
2k views

Automatically-reconnecting TCP tunnel

I have an unreliable network connection between two machines: sometimes active TCP connections get dropped for reasons beyond my control. I want to establish a reliable TCP connection between the two ...
7
votes
3answers
12k views

Allow scp/ssh for www-data user

I am on Amazon EC2 using Ubuntu 10.04.2 My web folder is owned by www-data so I want to be able to log into my server as www-data for ssh and scp. Thanks! Adding the line to my /etc/ssh/sshd_config ...
7
votes
5answers
3k views

Stop ssh client from offering all the public keys it can find?

Like most sysadmins I use openssh all the time. I have about a dozen ssh keys, I like to have a different ssh key for each host. However this causes a problem when I am connecting to a host for the ...
6
votes
1answer
4k views

SSH key authentication using LDAP

In short: Would like a way to do SSH key authentication via LDAP. Problem: We use LDAP (slapd) for directory services and we've recently moved to using our own AMI for building instances. The ...
6
votes
2answers
10k views

SSH tunnel over multi hops using putty

I have a situation where I want to connect to a Linux machine running VNC (lets call it VNCServer) which is behind two consecutive Linux machines i.e., to ssh into the VNCServer, I have to ssh into ...
5
votes
2answers
12k views

SSH sessions terminate abruptly with message: Corrupted MAC on input. Disconnecting: Packet corrupt

We have a Dell PowerEdge 840 Server running CentOS 6.0 64 bit with 2GB ECC memory. When any user sshs in, after some time the session gets terminated with the output: Corrupted MAC on input. Packet ...
5
votes
2answers
13k views

execute su -c over ssh

I am trying to check the BIOS version of a server over SSH, a command that requires root privileges: ssh remote-server su -c dmidecode but this of course fails with the error: standard in must ...
4
votes
2answers
2k views

Remote server hangs, gets stuck. How to debug?

I have an vps running on VmWare ESX with Ubuntu 8.04 LTS. It has been running smoothly for the past 3 months, however recently we've notices two strange bugs. a. The server hangs, today was second ...
3
votes
1answer
1k views

SSH from Windows to Linux with AD certificates

I have a Windows client machine connected to Active Directory and a Linux server also connected to Active Directory (through PAM w/ LDAP), and I want to be able to do password-less SSH from Windows to ...
3
votes
3answers
5k views

Ubuntu-server: gitosis user naming convention

If you install gitosis on ubuntu-server 10.10 via apt-get: sudo apt-get install gitosis The post-install script will create a new gitosisuser. This user will be used to allow people to connect with ...
3
votes
4answers
3k views

Looking for a one step solution to appending my SSH public key to a server's authorized_keys?

To get my public key onto a server I normal copy the contents of my public key, then SSH into the server, then I run vi .ssh/authorized_keys, then paste my key into the file and save. There has got ...
3
votes
6answers
2k views

Same command on multiple servers

I'm just wondering if there is any fellow sysadmin with the need to execute one command on multiple servers. If so, what technique are you using? I have grown tired to ssh-ing to 3-5 servers and ...
14
votes
7answers
4k views

I screwed up, exit in .bashrc

I put "exit" in my .bashrc file. I don't have physical access to the machine so to connect to it I use ssh. I don't have root privileges. Every time I connect to the server, the connection ...
13
votes
5answers
12k views

Force SSH to use a specific shell

Is there any way to force SSH to use a particular shell on the remote end, regardless of what the user's default shell is? I've tried solutions akin to: ssh host.domain.com /bin/bash -c ...
11
votes
3answers
6k views

What is the benefit of not allocating a terminal in ssh?

Every once in a while I will do something like ssh user@host sudo thing and I am reminded that ssh doesn't allocate a pseudo-tty by default. Why doesn't it? What benefits would I be losing if I ...