Install hook with ubuntu user?

I am attempting my first charm, and successfully gotten something that is starting to look okay…

I seem to perform su ubuntu , change directories … but when I see the results it is still root

any ideas how to change users and install as ubuntu user?


apt install libxrender1 libxtst6 libxi6 -y
juju-log -l 'INFO' 'XServer Dependencies installed'

su ubuntu
ch /home/ubuntu

curl --output
chmod +x
chown ubuntu.ubuntu

# Install IB Gateway
yes n | ./


juju-log -l 'INFO' 'IBGateway Installed'

resulting charm

You have chown the script, but the subsequent exec of the script is under root.

You could try one of the methods listed here:

1 Like

I got it to work actually… with this bash technique

sudo -u ubuntu ./

this tells linux to run the command as the user after the -u flag. even setting the owner to ubuntu had not been enough.

Thanks Erik!

1 Like