sudo does not work
Matthew Hannigan
mlh at zip.com.au
Wed Sep 18 01:31:22 EDT 2002
On Wed, Sep 18, 2002 at 12:16:01PM +0800, nina wrote:
> Hi,
> I'm currently exploring how to use sudo. I already installed & configured, but could not get something right. What I wanted to do was sudo to let's say newuser and open pine as newuser.
>
> as olduser, i typed this command
> sudo -u newuser pine
> it asks for the olduser password(ok), then I got an error saying that i cannot open ~olduser/mail because of permission denied.
> I thought I was supposed to open newuser's mailbox? Then why is it trying to open the olduser's mailbox? Is my understanding of how sudi should work correct?
>
> I think my configuration in sudoers file is already correct, the entry is as below :
> olduser ALL = (newuser) /usr/local/bin/pine
This is because pine uses environment variables
find things, and sudo doesn't necessarily overwrite
or remove environment variables.
It's not just pine, of course many programs work like this.
The particular variable is probably HOME or MAIL or
something like that.
sudo really only changes id; it doesn't set up the
environment necessarily. It does remove some dangerous
env vars; see the FAQ.
Solution? Use the -H flag (set HOME); or if that doesn't
work, make the sudoers entry:
olduser ALL = su - newuser /usr/local/bin/pine
and invoke
sudo su - newuser /usr/local/bin/pine
which will do a 'proper' login
Regards,
Matt
More information about the sudo-users
mailing list