Wednesday, May 2, 2012

SSH aliases

This cool idea came from the March 2012 Linux Format magazine.

Edit your ~/.ssh/config file and if it doesn't exist create one.
To do this type...
touch ~/.ssh/config

Now edit using your favourite text editor.

Add 4 lines...
Host work
  Hostname myworksdomain.net
  User myusernameatwork
  Port 2022

Then save the file. Note the domain at work could be an IP number and the port could be the default port of 22.

Then when you want to ssh to your work just type
ssh work

and when prompted enter your password. this saves you typing long commands like ...
ssh -P 2022 myusernameatwork@myworksdomain.net

No comments: