Shortcuts to SSH clients
You can do a lot using .ssh/config
file. It would allow you to replace this:
ssh [email protected] -p 22000
with:
ssh dev
to do so you have to add the following lines at the end of the .ssh/config
(create it if does not exist)
Host dev
HostName dev.example.com
Port 22000
User fooey
Concerning the storage of your credentials, I strongly advise you to use key authentification instead of password based. You can create them either with a GUI or with your terminal.
GUI
open Seahorse
, select File > New
, then Secure Shell Key
and let the interface guide you
Terminal Create you RSA key pair:
ssh-keygen -t rsa
Store the Keys and Passphrase:
Enter file in which to save the key (/home/demo/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Copy the Public Key
ssh-copy-id [email protected]
Sources:
- http://nerderati.com/2011/03/17/simplify-your-life-with-an-ssh-config-file
- https://www.digitalocean.com/community/tutorials/how-to-set-up-ssh-keys--2
If you wanted to, you could make short shell scripts to launch your ssh sessions, then execute them either as s executable ( chmod o+x
), or using the dot .
command
Like make a file ~/ssh2hostA.sh
#!/bin/sh
sshpass -p 'yourpassword' ssh user@hostA
then start it with
. ~/ssh2hostA.sh
Which is not a good thing to do because not only do you have passwords in cleartext scattered in your files, but people will probably be able to see the password in the w
command. ( and top
, and /proc
)
Really, you should be using ssh host keys for this.
Really.