How-to access a cloud-stack machine in a easy way

(Jerker Montelius)

Or SSH to your rescue.


Normally you access a cloudstack machine with ssh like this:

$ ssh -l root -p 31022 80.239.222.6

root@80.239.222.6's password:

Last login: Thu May 16 13:09:10 2013 from 217.76.85.171

[root@jerker-puppet-master ~]#



Its long. Its error prone. Its prompts for passwords. This is not something I would like to type 10 times every day.

But fear not. Ssh has some tricks you can use.



In the file ~.ssh/config you can create aliases for machines and parameters. Lets create a entry for our machine.

Host JPM

HostName 80.239.222.6

User root

Port 31022

This gives us

$ ssh JPM

root@80.239.222.6's password:

Last login: Fri May 31 10:13:25 2013 from 217.76.85.171

[root@jerker-puppet-master ~]#

But it prompts for password? Yes bu lets fix that. Lets install our certificate on jerker-puppet-master

$ ssh-copy-id JPM

root@80.239.222.6's password:

Now try logging into the machine, with "ssh 'JPM'", and check in:

~/.ssh/authorized_keys

to make sure we haven't added extra keys that you weren't expecting.

$ ssh JPM "cat ~/.ssh/authorized_keys"

XXX jermon@jermon-Inspiron-3721