Ubuntu – Don’t have sudo privileges in juju nodes when using Landscape


I'm working on a custom charm that I'd like to deploy in my Landscape setup. I've got a functional cloud up and running via MAAS and openstack-install (can launch instances etc). To get access to the juju setup used by Landscape, I did the following on my MAAS node:

*export JUJU_HOME=~/.cloud-install/juju

juju status

juju ssh landscape-server/0 sudo 'JUJU_HOME=/var/lib/landscape/juju-homes/sudo ls -rt /var/lib/landscape/juju-homes/ | tail -1 sudo -u landscape -E bash'

juju status*

(As per How can I see what Openstack services have been deployed to which servers once Openstack Autopilot has completed successfully?)

So now I can SSH into the landscape node. However once I SSH in, I want to scp across the files for my custom charm so that I can deploy locally, but I get a Permission Denied error.

I can't even create a new directory as a regular user.
landscape@juju-machine-0-lxc-1:~$ mkdir ola
mkdir: cannot create directory ‘ola’: Permission denied

Sudo'ing asks for the landscape password, which I don't have. How do I get around this?

Best Answer

You can juju ssh into landscape-server/0 without the long sudo line, that will get you into that node as "ubuntu" which can sudo to any other user without a password, including landscape.

Put the files where you want in landscape-server/0, make sure the landscape user can access them, then become the landscape user and set JUJU_HOME. Then you can juju scp them into any node in the inner cloud environment.

The landscape user doesn't have a shell by default, that's why that long sudo line you found runs the bash command in the end.

Related Question