Slosh automatically saves your SSH connection, as you make it, to your SSH config file (~/.ssh/config
). It also allows you to update connections with new details (like changing the username or adding compression) without having to manually edit the config file.
Check out this guide for a primer on the handy SSH config file: Using the SSH Config File.
$ pip install slosh
By default slosh
is simply a pass-through to the ssh
command. So you can run any ssh
command normally, using slosh
.
$ slosh -i ~/.ssh/mykey.pem [email protected]
To save a connection to the SSH config file add --save-as <host alias>
to your connection command. The host alias is how you will reference the connection in the future.
$ slosh -i ~/.ssh/mykey.pem --save-as myserver [email protected]
Above we used --save-as myserver
to save the connection information to the SSH config file under the alias myserver
. This means that we can now run slosh myserver
or ssh myserver
to connect to the server.
Simply use the --save-as
option with the host alias of the connection you wish to update. Here we add compression (-C
) and change the login username (newuser
) of our original connection.
$ slosh -i ~/.ssh/mykey.pem -C --save-as myserver [email protected]
The below ssh
options are captured by slosh
and saved to the config. Let me know if you'd like more options to be added.
-l <user>
: Specifies the username for the connection.-p <port>
: Specifies the port number for the connection.-i <identity file>
: Specifies the path to the private key file for the connection.-A
: Enables forwarding of the authentication agent connection.-C
: Requests compression of all data.-v
: Increases verbosity. Can be used up to three times (-vvv
).
For a comprehensive list of all ssh
options and their explanations, refer to the official SSH manual page: SSH Manual Page.