Hello,
If you connect twice or more to the same server and you don’t want to reauthenticate again, you can use a socket to bypass it. You need OpenSSH 4.x or higher.
Normal situation:
1) First time
$ ssh ruben@pc-rgonzalez
ruben@pc-rgonzalez’s password:
2) Second time
ssh user@pc
user@pc password:
This is the normal behavior, so you need the put credentials twice.
Using ssh socket feature bypass it, so on the CLIENT side you need to add these lines.
(youre path here)
/etc/ssh/ssh_config
# socket speed up
Host *
ControlMaster auto
ControlPath ~/.ssh/socket-%r@%h:%p
Better situation:
1) First time
$ ssh user@pc
user@pc password:
2) Second time
$ ssh user@pc
$ (no password needed!)
It’s also create a socket in your home like this:
file /home/user/.ssh/socket-user\@pc\:22
/home/user/.ssh/socket-user@pc-user:22: socket
If you close your ssh session , socket will be deleted until you create a new one using another ssh session.
It works nice if you need to exec a command behind a firewall like:
(create a session in background, it also creates the socket)
$ ssh -N -f user@firewall
then
ssh user@firewall “ssh -t user@anothermachine”
ssh user@firewall “ssh -t user@anothermachine2”
etc
See you!
[…] Geplaatst door JephapE op 23 september 2010 https://anothersysadmin.wordpress.com/2007/08/27/speed-up-openssh-connections-using-socket/ […]