07 September 2013

Handling Multiple SSH Keys

I recently blogged on Creating a Digital Ocean Droplet, today I want to cover how I solved my need for multiple SSH keys so I can keep my work public key separate from my Digital Ocean account.

Having only one SSH key I wanted another for my Digital Ocean account.

You'll need a console.
cd ~/.ssh folder
mkdir digital
ssh-keygen -t rsa -C "you@<youremail>.com"
Generating public/private rsa key pair.Enter file in which to save the key (/Users/<you>/.ssh/id_rsa):  <Press Enter>Enter passphrase (empty for no passphrase):<Enter your passphrase>
The key will be create, move it to your required folder:
mv id_rsa* ./digital
Initialise it:
ssh-add ~/.ssh/digitalocean/id_rsa
Enter passphrase for /Users/<you>/.ssh/digital/id_rsa:
Identity added: /Users/<you>/.ssh/digital/id_rsa (/Users/<you>/.ssh/digitalo/id_rsa)
Verify your keys are visible:
ssh-add -l
2048 <hash> /Users/<you>/.ssh/digital/id_rsa (RSA)
2048 <hash> /Users/<you>/.ssh/anotherdomain/id_rsa (RSA)
Repeat as necessary. Then add your key to your server so your login is simple ssh <user>@<ip> no password required.

30 August 2013

Creating a Digital Ocean Droplet

I've recently started tinkering with Digital Ocean, it's my first time working with a VPS from scratch and I wanted to document my progress and hopefully it'll help someone else along the way.

To learn more about Digital Ocean you can visit their feature page, its all there. Pricing is reasonable, perfect for starting out.

Lets begin.

Each Digital Ocean server instance is called a Droplet, prices double with each droplet size and server options increase gradually.

Droplet creation page
I'm happy with the $5 a month option and went ahead in creating one of these, simply add a hostname, select your server location (Amsterdam, San Fran or New York) and select an image:

Digital Ocean image options
The choice of image simply means the base operating system your server will use. I went for Ubuntu 12.04 x32 as I have a lot of experience with this OS.

The 'Applications' tab gives you the ability to use a default Ubuntu 12.04 image with a mixture of popular apps pre-installed, such as Ruby on Rails or Wordpress. I prefer to manually install my packages and opt for the default image.

Next up you can add an SSH key to allow password less login from your console. This will add your public SSH key to the server on load meaning all you have to do is type 'ssh root@<server-ip>' and your in.

At this point I had a problem, I only have one SSH key installed on my Mac and I use this for work, although using this would work fine, I just don't want to use it here. I need a multiple SSH key solution!

I will follow up on this post with how I solved this in a future post.

Either use an SSH key or don't, if you don't you will be emailed your root password to your contact email that DigitalOcean has on record, be sure to change this immediately* as noone but you should know this.

Finally ensure 'Enable VirtIO' is left enabled, it'll improve your performance and click create droplet.

* To change your root password connect to your server: ssh root@<server-ip> and enter the password you have been emailed. Once connected type 'passwd', enter your root password again and then type in your new password twice.

If you want a perfect password you can use: https://www.grc.com/passwords.htm