How can I find out as what user a command executes? (I'm running Ubuntu, but I suspect the answer applies to Unix in general).
What I'm trying to do is get msmtp running and logging to /var/log/msmtp. I've set the owner and group of that file to mail, then added my user to the mail group via sudo adduser dandv mail:
$ ls -al /var/log/msmtp.log
-rw-rw---- 1 mail mail 0 Jul 24 18:45 /var/log/msmtp.log
$ groups dandv
dandv : dandv mail sudo
Yet when when I run
cat testmail | msmtp dan@example.org -v
I get a permission denied:
msmtp: cannot log to /var/log/msmtp.log: cannot open: Permission denied
What is msmtp's problem?
groups dandvtells you what groups the userdandvwould get if he logged in now. Rungroupswith no argument to see what groups your session's processes are in. – Gilles 'SO- stop being evil' Jul 25 '14 at 20:11