I love shortcuts – basically anything that help increase productivity. If you are like me, and need to connect to many different servers and or remote terminals, this one is for you. Before when I SSH’d I would open Terminal and type ssh firstname.lastname@example.org then enter the password at the prompt. Now I just type sshmt and it logs me into my MediaTemple server. Here is how I got it to work…
How To Auto Login to an SSH Connection with Terminal
1. Open Terminal
2. cd to your home dir
4. Create an alias in the file:
alias s='ssh -2 -p 22 email@example.com' replace “s” with whatever alias you want. remember I used sshmt
5. Save the file
6. Reload the bashrc file:
Now we need to create a keypair to authenticate with
7. In Terminal Type:
ssh-keygen Press enter when asked, you dont want to generate a passphrase
scp -P 22 ~/.ssh/id_rsa.pub user@host:~/ replacing user and host with your info.
9. Now log on to the remote machine:
ssh -p 22 user@host
10. Create the .ssh directory:
11. Append keys to file:
cat id_rsa.pub >> ~/.ssh/authorized_keys
12. Delete the public key:
rm -f id_rsa.pub
13. Log off the SSH connection:
Now test the connection:
ssh -2 -p 22 user@host it shouldn’t prompt you for a password. You now also can use the alias you created above!
Matt is a Systems Development Director for a multinational franchise. Matt has lived and worked in Hawaii, Chicago, South Florida and currently resides outside of Atlanta. He enjoys his hobbies including Technology, Gadgets/EDC, Fountain Pens, Wetshaving, Clocks, Antiques & Coffee. He even roasts his own coffee weekly.