User Tools

Site Tools


computing:linux:ssh

This is an old revision of the document!


SSH

Set Up SSH Keys

Troubleshooting

ssh -v ...

Session Timeouts and Slow Logins

Take care of both with this one-liner:

On the Client PC:

echo "Host *
        ServerAliveInterval 60
        GSSAPIAuthentication=no" >> $HOME/.ssh/config

(be sure to copy and paste everything including the CRLF's and spaces)

If a permissions error is thrown:

chmod 600 /home/gcooper/.ssh/config

Non-Standard Port

:!: Adjust your firewall first or you may lose access!

vim /etc/ssh/sshd_config

Port 2222

service sshd restart

Reverse Tunnels

http://www.howtoforge.com/reverse-ssh-tunneling

http://www.alexonlinux.com/reverse-ssh-tunnel-or-connecting-to-computer-behind-nat-router

This technique is used to access an SSH host behind a NAT firewall.

On the middle-man host with a real static IP address:

  • Set “GatewayPorts yes” in /etc/ssh/sshd_config
    • Restart sshd if sshd_config changed
  • Configure to use SSH keys rather than passwords
    • Less trouble
    • More secure

On remote host (behind NAT) that you want to access:

ssh -R 22222:localhost:22 root@middleman

or if SSH is listening on a non-standard port:

ssh -R 22222:localhost:22 root@middleman -p 2222

From your workstation, connect through the middle-man PC:

ssh -p 22222 root@middleman

AutoSSH

http://www.howtoforge.com/reverse-ssh-tunneling#comment-4762

Use AutoSSH to keep a tunnel up constantly.

computing/linux/ssh.1331162411.txt.gz · Last modified: 2012/03/07 16:20 by gcooper