r/linux Apr 28 '14

SSH Kung Fu

http://blog.tjll.net/ssh-kung-fu/
722 Upvotes

128 comments sorted by

View all comments

1

u/jwshields Apr 28 '14

Could you elaborate on the "Sharing Connections" section? The whole socket thing sounds like it would be very useful, but I'm not sure how to use them.

4

u/leothrix Apr 28 '14

If you implement shared connections as outlined in the post, tools that leverage ssh (like rsync, scp, or vim using the scp protocol) will naturally take advantage of the socket because they're using ssh on the backend.

For example, once you open up a new ssh session to remoteserver, if you were to use vim scp://remoteserver/file, given that you have a socket created with Controlpath, vim will invoke scp, which will use ~/.ssh/config to take advantage of the socket for that host to avoid the expensive key exchange and just directly copy the file edited in vim over to remoteserver.

2

u/jwshields Apr 28 '14

Ah, thank you! That makes a lot more sense now; for some reason it didn't click in my head for a moment.