Generating an SSH key (Mac OSX)
By Joe Gardiner Tuesday, 23rd March 2010
I have covered the topic of adding SSH keys to the CatN Control Panel in a previous guide, but this guide is specifically for generating an SSH key, not only for use with your vCluster.
The process differs between Mac OSX and Windows, and the Windows command prompt does not support SSH natively and must provide on a third party solution. Please note, if you have already know and have recorded your SSH key, then this guide is not for you!
Generating an SSH key MacOSX
So getting started we need to fire up a terminal. The first thing to do is check that your key pair does not already exist.
Click on spotlight and type terminal.
In the terminal we need to change to the ssh key directory to see if a key currently exists. Type:
$ cd ~/.ssh
If you get a “No file or directory” error than you can skip the next step…
Now type:
$ ls id_dsa id_dsa.pub id_rsa id_rsa.pub known_hosts $ mkdir key_backup $ cp id_rsa* key_backup $ rm id_rsa*
This process copies the current ssh keys into a backup directory, and clears the directory for generating your new keys.
Now that we have checked there is no existing key pair, it is safe to generate a new one. Go back to your terminal and type:
$ ssh-keygen -t dsa Generating public/private dsa key pair. Enter file in which to save the key (/Users/joegardiner/.ssh/id_dsa): Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /Users/joegardiner/.ssh/id_dsa. Your public key has been saved in /Users/joegardiner/.ssh/id_dsa.pub. The key fingerprint is: a7:e2:81:76:46:9a:48:cb:67:0d:34:6b:b2:78:81:6a joegardiner@Joe-Gardiners-iMac.local The key's randomart image is: +--[ DSA 1024]----+ | | | | | o | | . . o | |. + + . S . | |.+ B B o | |oE* B * . | |.. + + o | | . | +-----------------+
When prompted for the save location, you can just press Enter to choose the default. You should use a passphrase when working with your keys for security measure. Have a look at this guide for more information about working with passphrases.
We can view the public key with one simple command:
$ cat .ssh/id_dsa.pub
This commands concatenates the key we have just generated and diplays it as text. Here is the output from that command when I execute it.
sh-dss AAAAB3NzaC1kc3MAAACBANT0vFIneyaW0Dbyk0quf3nr0P1AC8KMuE9KUvAM4bPhS/O4dlxFaQtxbfc8 /KDvkvEmqRVIMZPtyRN1LpDbrIT+k0cc3pi++A/6wFhegJsSmBzvfN8y49jBePEzG0z+ob1mDg0sbdhiI yZzAS5N0otBViNGuPlc7T25+EuXqFV7AAAAFQCX33ZKB64MKL3xXyULAKC2jvc30wAAAIAMP6DKpoP5Vr8iey WoAIbBQ1ijcXP/zeyQS8qHqAvCZoWXgWRTHiA2jGgjFvcvefdfrUhUUk+8nEb2/37U0MZ+c9eRDUPOAXMRlWjfwsLLb71XD Ct8czstLpoAuOsfOf2yt++cFY7nEIFR/TS7Xhf2Oz4mCk3Ni/Pd8wdFpAUToWAAAAIALAGZ9iYAVZTX ttcSKJO7XGNsxS9wxAxAE9ftAi2DAekuDjIMZcRcA9I3yc0VApjdfFMjPIICLHXXV+ThmFfXVoD0baOKI7p Kd8LVE3SHZ6srs1sGfHl65A5DwY/zvLoZLxp8Ks08Ufu/xQupeQQ1nhclSJCO49vBHtPW8uJdXOA== joegardiner@Joe-Gardiners-iMac.local
I can now copy this key for use with my vCluster or any other location I wish to access in a secure shell.
Posted in Guides, SSH |
No Comments »