How to Setup Reverse SSH Tunnel on Linux

by Himanshu Arora on November 27, 2013

Reverse SSH is a technique that can be used to access systems (that are behind a firewall) from the outside world.

As you already know SSH is a network protocol that supports cryptographic communication between network nodes. Using this protocol, you can do a secure remote login, secure copy from/to a remote machine etc.

Question: When I perform rsync, it asks for my password on the remote server before starting the transfer. I would like to avoid this, and perform rsync without password. Can you explain with an example on how to setup rsync over ssh without password on Linux?

Answer: The following steps explains how to setup rsync over ssh that doesn’t ask for a password. This is helpful when you are scheduling a cron job for automatic backup using rsync.

OpenSSH options are controlled through the /etc/ssh/sshd_config file. This article explains the 7 default options in sshd_config file that you should change.

In sshd_config, the lines that start with # are comments. For those options that uses the default values, the sshd_config file contains a commented line with the option and its default value.

This makes it easier for us, as we can see the OpenSSH option name and the default value without having to lookup somewhere else.

How To Fix Offending key in ~/.ssh/known_hosts file

by Ramesh Natarajan on April 30, 2010

As we discussed earlier in our basic ssh client commands article, when you do ssh to a machine for the 1st time (or whenever there is a key change in the remote machine), you will be prompted to say ‘yes’ for authenticity of host.

When you have the password-less login enabled, you may be either using SSH to execute command in the batch mode on a remote machine or using SCP to copy files from/to the remote machine.

If there are some issues with the password less login, your batch program may end up in a loop or timeout.

In this article, let us review how instruct ssh/scp to do the operation only if you can do without waiting for password.

[OpenSSH Logo]You can login to a remote Linux server without entering password in 3 simple steps using ssky-keygen and ssh-copy-id as explained in this article.

ssh-keygen creates the public and private keys. ssh-copy-id copies the local-host’s public key to the remote-host’s authorized_keys file. ssh-copy-id also assigns proper permission to the remote-host’s home, ~/.ssh, and ~/.ssh/authorized_keys.

This article also explains 3 minor annoyances of using ssh-copy-id and how to use ssh-copy-id along with ssh-agent.