If you are lazy and don't want to type the whole ssh
or scp
commands over and over again, you'll love this.
If you don't wish to use the default ~/ssh_hosts_list
hosts file, export the variable AUTOSSH_REMOTE_HOSTS
on your .profile
or equivalent pointing to your custom hosts file.
autossh
prompts to connect to any of your registered remote hosts.autossh -e
edits your remote hosts file, creating a sample if not existent.autossh -x -r 3
orautossh -x -r3
connects you to the third remote available, sorted alphabetically, from your hosts file.autossh -xr1 -d. /absolute/path/files*
downloads all files matching the pattern/absolute/path/files*
from your registered remote #1 to the current working directory, showing thescp
command that will be executed beforehand.autossh -r1 -u /absolute/remote/path/ /absolute/path/files* relative/path/files*
uploads all files matching the patterns/absolute/path/files*
andrelative/path/files*
from your local computer to the/absolute/remote/path/
directory on your registered remote host #2.autossh -xc50 -d relative/destination/path /absolute/path/files* relative/path/files*
downloads all files matching the patterns/absolute/path/files*
andrelative/path/files*
from your registered remote #1 to therelative/destination/path
directory, showing thescp
command that will be executed beforehand.
Running the following command will install autossh to $HOME/programs
, substitute the current link to /usr/local/bin/autossh
and create, if not yet existing, the $HOME/ssh_hosts_list
file as an example.
curl -fsSL https://raw.githubusercontent.com/marcosalles/autossh/master/install | sh