Category Archives: SSH

Linux: How To Setup Reverse SSH Tunnel

Let’s assume you’re trying to SSH from your home machine into your office machine, but inbound port 22 is blocked by your office firewall. Here’s how to get around it: On your office machine: $ ssh -fnNTR 1234:localhost:22 my-home-username@my-home-domain.com What … Continue reading

Posted in Linux, SSH | Leave a comment

How to Fix "SSH Public Key Authentication Failed"

If your SSH public key authentication is failing with errors like this: $ ssh -vvv myhost.com debug3: authmethod_is_enabled publickey debug1: Next authentication method: publickey debug1: Offering public key: /home/kitamura/.ssh/id_dsa debug3: send_pubkey_test debug2: we sent a publickey packet, wait for reply … Continue reading

Posted in Linux, SSH, Troubleshooting | 1 Comment

ssh_exchange_identification: Connection closed by remote host

On the destination server, remove the known_hosts file: rm ~/.ssh/known_hosts Remove any relevant entries in your /etc/hosts.deny file: /etc/hosts.deny: # DenyHosts: Fri Jun 25 16:10:25 2010 | sshd: xxx.xxx.xxx.xxx sshd: xxx.xxx.xxx.xxx Also, try this in your /etc/hosts.allow file /etc/hosts.allow: SSHD: … Continue reading

Posted in Linux, SSH, Troubleshooting | Leave a comment

How to Automatically Start Pageant with Private Keys in Windows

In the Startup folder in the startup menu, right-click and create a New -> Shortcut. Browse to your pageant.exe file. Add the full path to your private key enclosed with quotes. Save the shortcut. “c:\path-to-pageant\pageant.exe” “c:\path-to-key\mykey.ppk”

Posted in SSH, Windows | 1 Comment

How to keep SSH sessions alive

Edit your ssh_config file like this: /etc/ssh/ssh_config: ServerAliveInterval 30 This will cause your SSH client to send a keep alive ping every 30 seconds to the server.

Posted in Linux, SSH | Leave a comment