I need to copy several small files from a remote machine to a local one. I need to do this several times a day. Currently, I use a script that use scp to copy the files. However, this is slow as every time, I need to authenticate. Is there a way, beside mounting, to do one authentication and keep it alive until I finish the copy?
Just use the ControlMaster feature of SSH. For this purpose I placed a global Option:
In my .ssh/config. Of course you must replace
Whenever I want to setup an initial master connection I add '-M':
This creates a control socket with a filename specified above. Any subsequent call to ssh/scp targeting that
You can use ssh-add to add private keys to your ssh authentication agent. See