Devops work with many different remote systems at once. For the lazy bunch ( a.k.a the truly productive bunch who look for ways to make their work easy – a.k.a the really bright ones ) there are ways to make life easier.
So instead of typing
(or wait, was it 184.108.40.206??), and then entering the password that no one can remember given to us by the sysadmin, I’d now say
The steps to get there are:
SSH Passwordless Entry
Step one is to get rid of those pesky passwords required each time you SSH into a host. This can be achieved by setting up an RSA (public/private key). And besides, who’d say no to added security?
To generate a SSH key if you don’t have one already, run
mkdir ~/.ssh chmod 700 ~/.ssh ssh-keygen -t rsa
You will be prompted for a location to save the keys, and a passphrase for the keys. This passphrase will protect your private key while it’s stored on the system.
Generating public/private rsa key pair. Enter file in which to save the key (/home/b/.ssh/id_rsa): Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /home/b/.ssh/id_rsa. Your public key has been saved in /home/b/.ssh/id_rsa.pub.
Your public key is now available as .ssh/id_rsa.pub in your home folder.
Next, the little bit of magic where you’d copy your key over to the remote/host machine. If you can SSH into the machine, then this should be no problem. Run
Done. You can now login by saying
ssh email@example.com And the system shouldn't ask you for a password.
SSH Hostname Shortcuts
But wait – we want more (or less, actually). The next step is to shorten this further. For this create a file .ssh/config with the following entries:
Host [shortcut] Hostname [full-hostname] User [username]
Host devserver Hostname 220.127.116.11 User whitewizard
And voila, now running the following will log you into the system
Of course, replace the above hostnames and usernames with you own – else you’d be login into Saruman’s own server!