How can I check the mailbox of another user in Linux (CentOS)? Basically I want to replicate the
$ mail
command but when sudo-ed as another user.
Right now if I try to just do
$ sudo -u johndoe mail
I get
/var/spool/mail/jordan: Permission denied
Same thing if I use
$ sudo su johndoe
and then run the mail
command.
Try this:
The
-
parameter tosu
should take care of setting up the environment forjohndoe
so the right mailbox is accessed.