Hi Haosdent, Yes, I had confirmed that setuid does get called correctly, and the shell environment is not set up. My question is more along the lines of "is this expected? is it a bug? is it intentional?" If it wasn't intentional, I was thinking maybe I'll try a making a small patch to see if it works out.
I couldn't find the JIRA ticket. Happen to know what it was or anything it might be referring to? Thanks, -Hansel On Jun 16, 2016, at 8:00 PM, haosdent <[email protected]> wrote: > Hi, @Hansel Chung As I checked, if --swithc_user=true (default variable is > true) when you launch Mesos agent, executor would call os::setuid and > os::setgroups before launch your tasks. But the shell environment may not > set. (I remember we have a ticket for this.) You could use `id` as your task > command to verify if user set correctly. > > > On Fri, Jun 17, 2016 at 9:17 AM, Hansel Chung <[email protected]> wrote: > Hi, > > I had a question, I noticed that if mesos frameworks request that executors > use a certain user, the env variables aren't set up for that user, but what > the agent daemon was run as. > > As an example: > Run mesos-slave as root: > HOME=/root > USER=root > > If I have an executor to be launched as testuser, the env looks like: > HOME=/root > USER=root > instead of: > HOME=/home/testuser > USER=testuser > > This is normally set by login or sudo when running as a user, but I can't > seem to find a way to use these to set up a proper environment as the target > user. Is there a reason we don't call getpwuid() to set a $HOME during setup > of execlp() from executor.cpp? (Oh, and might as well populate $USER while > we're at it) > > Thanks, > -Hansel > > > > -- > Best Regards, > Haosdent Huang

