Very often, while working on a network node via SSH, we need multiple connections to the same node. For example, say you are connected to a node A, and then you need to transfer a file to the same node from your local machine. Then we have to scp, which establishes a fresh connection to that machine and one has to enter the password again. So, it takes some time as well as it is irritating to enter password again and again.
Here’s the remedy :
Open the file /etc/ssh/ssh_config or /etc/ssh_config (which ever is applicable) on your local machine as root to edit. Or if you are not the root user, you can create a file ~/.ssh/config for user level SSH configurations.
Add the following lines at the end of the file you opened just now:
Save the file and you are done !!
Now check out (One can try it this way) -Open a terminal and connect to a server :
$ ssh firstname.lastname@example.org
The connection gets established after entering the proper password.
Then in another terminal try to copy a file from your local machine to the same server :
$ scp -r ~/pintos email@example.com
This time, you don’t need to wait for a fresh connection, neither you will have to enter the password again. File transfer starts instantaneously. SSH shared the already established connection.
Similarly you can open another terminal without waiting and entering the password again.
One can check out more configurations for SSH by checking out the man pages of ssh_config
$ man ssh_config
Hope you liked this tip !!