I'm writing a charm that I deploy on a local juju instance. Works great, but it would help debugging the charm if I were able to SSH into the instance. Is there a way to do this?


Yes, you can ssh directly into any juju node with juju ssh, for example:

juju ssh mysql/0

or just the machine # if you want to do it that way:

juju ssh 0 

This will ssh you into whichever unit of whichever service. I prefer to do it by service name because I tend to mix up numbers. If you're looking to debug a charm however, you should check out juju debug-hooks, which is an interactive ssh/tmux session designed to do exactly what you're doing.

If you're not on a Juju enabled box and need to SSH in, you need to find the IP/hostname of the machine to ssh to. In the case of Amazon or HP Cloud you can get this information via the usual CLI tools or by using the web console to get the IP that the provider has assigned the instance.

  • 1
    But how to do it directly, from machines without "juju" installed, like Windows clients? – Marius K Mar 22 '13 at 15:24
  • 1
    @MariusK I don't think that's possible, you'd need to either obtain the matching private key, or to put your public key into the authorized_keys file on the target machine first. Both is probably a bad idea. Just ssh into the machine that hosts juju first and proceed as described in this answer. – jlh Apr 15 '16 at 10:27

Sorry for the necrobump!

I found the correct key. It is in the folder /home/$user/.juju/ssh/juju-id-rsa.pub.

Grab a copy of the two keys in that folder and point ssh to use them to gain access anywhere! :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.