You are not logged in.
Hi, I have dovecot and postfix servers running on archlinux as explained in archwiki. Things do work fine except when I log in as userA and then su to userB.
After su to userB, if I issue command
mail
then I am still reading mails for userA and not for userB. Example:
[userA@hostname ~]$ su userB
[userB@hostname userA]$ mail
mail: /var/spool/mail/userA: No such entry, file or directory
mail version v14.9.11. Type `?' for help
(Currently no active mailbox)
No more mail.
There are new messages in the error message ring (denoted by ERROR)
The `errors' command manages this message ring
ERROR# ?
here, there is no mail account corresponding to userA, whence the error, but the issue is, if I change my identity to userB to read mails, then I should be able to read mails for userB and not for userA. Is this the expected behavior of dovecot, or am I doing something wrong?
Last edited by kde35 (2019-01-06 17:17:47)
Offline
Most environment variables do not change, when you run `su userB', though $USER does.
Not that I would trust it to work, but try `su --login userB'.
Last edited by respiranto (2019-01-06 10:13:12)
Offline
Which "mail" implementation are you using? S-nail's mail does not use $USER if $MAIL or $MBOX are set. If either of the latter two are set in userA's environment, su'ing to userB will still inherit that environment. The `su` man page also strongly advises to use the above-noted --login flag for this very reason.
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
Thank you very much,
su --login
works. Yes, I am using s-nail.
Offline