SSH Connection Shortcut

openssh-mac

Occasionally I have to leave my XP workstation and use Linux or Mac Desktop, both don’t have putty like in XP, most probably because they have built in SSH client installed :).

But I need somehow make it easier to connect from those desktop to servers with Key Authentication, instead of running this from the terminal;

ssh -p xxxx -l root 117.103.xx.xx -i ~/ssh-keys/me\@tajidyakub.net.ppk

While in Putty, I could simply use Connection Sessions preferences load a particular private key for specific connection and utilize Putty PageAnt to Authorize the pass phrase automatically. It is as simple as it gets since I only have to double click, and logged in instantly.

But turns out I can do the task event simpler in Linux or Mac. I create a folder in My Desktop to store my connection;

mkdir ~/Desktop/SSH/

And create a file with .sh extension. doesn’t have to be .sh extension, just wanted to name it that way :).

cd ~/Desktop/SSH/
vi myserver.sh

And insert the content;

ssh -p xxxx -l root 117.103.xx.xx -i ~/path/to/yourprivatekey.ppk

yourprivatekey.ppk is a private key, in my case, I exported it using Putty Gen from my XP machine so it is going to look like this;

tjdykb$ cat me\@tajidyakub.net.ppk
-----BEGIN RSA PRIVATE KEY-----
Proc-Type: 4,ENCRYPTED
DEK-Info: DES-EDE3-CBC,...
nYMNS/d7RJSx1qswncyw2cd7NiCXfwZkQ6m+OMzcCtXMj8vCBDhTSyhkwxQ0lByY
tgp0zA3HkKKYI5ACl5+Q7MEZwwi+Dpz8wHY2E5adjqAbWm5M/Li9e1EBJgWM15EQ
.......
8OfpeNjO85IGBPpNYct56Z1VFCpadkph0WPE1vdrLmjhQOBu2ftamY8hJ9kFaNRH
At/j4dC4HI3kwmuM7onZIb2vZIfxmW2sUceY2NhBLEbT+kOd3Tu2/EYkKNlfmW43
3gfOqCOzUqnGON7hopzQbMK/PfvOvT+bPIE14RZG8IFhiNUu10yrd+FkF6HFlNIi
ljJTuFKDgCm/3OezeV/bzWcVMkBqoaMwxN/hI7OHe1HYb0QpZbIU/ePwt6cVGYSh
zfkIFTJl61WWTvB81oRhS5JZ6nf3OUkuFxCjJ4PseFw=
-----END RSA PRIVATE KEY-----

And to load the connection from a terminal, simply execute the file (don’t forget to chmod so it becomes executable – like 755);

./yourserver.sh

In a desktop environment, a pop up will appear asking for the pass phrases, you could add the pass phrase to your key chain or saved password avoid this the next time you load the connection.

keychain

This entry was posted in Nix Basics and tagged , . Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

  • Magnet Hosting, Hosting, VPS dan Server Indonesia
  • Categories

  • Archives