/srv/irclogs.ubuntu.com/2021/06/08/#cloud-init.txt

parideblackboxsw, heh right I should check ubot5, I'm not sure on how that's configured07:07
parideLP: #123408:18
ubottuLaunchpad bug 1234 in Launchpad itself "Gina is an unmaintainable mess of command line options, environment variables and shell scripts" [Medium, Fix Released] https://launchpad.net/bugs/123408:18
paridehttps://github.com/canonical/cloud-init/pull/91608:18
ubottuPull 916 in canonical/cloud-init "Change module order: run 'users-groups' before 'write-files'" [Open]08:18
parideblackboxsw, ^^ ubottu replaces ubot5 and also knows some more tricks!08:18
tsujpWhen do user-data scripts execute?14:56
tsujpThings like $USER and $HOME don't exist in `env` in my debug attempts14:56
goneritsujp, I would try something like: `sudo -i -u myuser mycommand`15:07
tsujpok goneri will try now15:09
tsujpwhere is this `-i` and `-u` coming from goneri? I don't see those as valid flags on ubuntu `su`?15:11
tsujp`man su` doesn't show them15:11
gonerimy example is based on sudo. You can do the same thing with su.15:12
tsujpoh whoops `sudo` read that as `su` for some reason...15:12
tsujpwell im already root, right. This is a user-data script15:12
tsujpI'm going to re-try `su -l myuser` to double check it does not work15:13
tsujpWhy would `sudo` from root be any different?15:13
goneriyes but by doing so you impersonate the user.15:13
tsujpif mycommend is a shell script will that keep the impersonation?15:13
goneriyes. Take a look at the docuementation of sudo's -i/--login parameter15:14
tsujpwill do goneri15:21
tsujpYeah you guys were right, turns out I was a big dumb dumb and because I was testing this locally in an interactive-shell doing `su - myuser` drops me into that shell15:25
tsujpbut because it's interactive it doesnt immediately exit right15:25
tsujpWhat a brainfart that took like 30 minutes to alleviate, maybe it's bed time for me15:26
tsujpAnyway thank you for the help :)15:26
goneriGood night tsujp :-)15:26
rharperparide: thanks for the bot upgrade 17:24

Generated by irclog2html.py 2.7 by Marius Gedminas - find it at mg.pov.lt!