Very handy to use.
Open ~/.ssh/config file (ssh client configuration file). If you need system wide settings add to /etc/ssh/ssh_config file:$ vi ~/.ssh/config
Append following code to reuse ssh connection for all hosts:
host *
controlmaster auto
controlpath /tmp/ssh-%r@%h:%p
Where,
- controlmaster auto: Set controlmaster to auto
- controlpath /tmp/ssh-%r@%h:%p: Specify the path to the control socket used for connection sharing. In the path, ‘%h will be substituted by the target host name, %p the port, and %r by the remote login username. It is recommended that any ControlPath used for opportunistic connection sharing include at least %h, %p, and %r. This ensures that shared connections are uniquely identified.
You can also match any host in the 192.168.0.[0-9] network range with following pattern:
Host 192.168.0.?
controlmaster auto
controlpath /tmp/ssh-%r@%h:%p
For any host in the ".co.in" set of domains, reuse the connection:
Host *.co.in
controlmaster auto
controlpath /tmp/ssh-%r@%h:%p
Save and close the file. Now connect as usual,$ ssh vivek@vpn.nixcraft.co.in
Next, time you connect again it will use connection socket /tmp/ssh-vivek@vpn.nixcraft.in:22 to speed up things. You don't have to input password or anything else. You need one connection to be active for the second to be accelerated. This also works with scp / sftp etc:$ scp /path/to/file.txt vivek@vpn.nixcraft.co.in:/tmp
Welcome if still its not working on your machine.
You can have ~/.ssh/config file configured as
===============================================
host lin
hostname 172.16.13.20
user root
port 22
host Lin
hostname 172.16.13.20
user mahendra
port 22
host *
controlmaster auto
controlpath /tmp/ssh-%r@%h:%p
===============================================
Comments welcome !!!
No comments:
Post a Comment
Comments welcome :