[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

sudo 'class' directive not doing what I would expect



Hello people,

I'm assuming I'm misunderstanding something here, but I can't seem to get 
sudo's '-c' option to do what I want / expect.

Simple Example :

In /etc/login.conf, I have the following classes defined :

default:\
        :path=/usr/bin /bin /usr/sbin /sbin /usr/X11R6/bin /usr/local/bin:\
        :umask=027:\
        :datasize-max=256M:\
        :datasize-cur=256M:\
        :maxproc-max=128:\
        :maxproc-cur=64:\
        :openfiles-cur=64:\
        :stacksize-cur=8M:\
        :localcipher=blowfish,6:\
        :ypcipher=old:\
        :tc=auth-defaults:\
        :tc=auth-ftp-defaults:

service:\
       :path=/var/empty:\
        :umask=027:\
        :datasize=256M:\
        :maxproc=128:\
        :openfiles-cur=128:\
        :stacksize-cur=8M:\
        :localcipher=blowfish,6:\
        :tc=default:

I have a user (let's call it 'me') with the class 'service' set for it. ie...

> chpass me

...will print...

# Changing user database information for me.
Login: me
Encrypted password: *
Uid [#]: 1003
Gid [# or name]: 1003
Change [month day year]:
Expire [month day year]:
Class: service
Home directory: /home/me
Shell: /sbin/nologin
Full Name: Me
Office Location:
Office Phone:
Home Phone:

If (from root), I do this....

> sudo -u me -c service echo env

...I would expect it to print the environment of the 'service' class, but it 
doesn't - instead it seems to prints the environment of 'default' class.

eg :

SSH_CONNECTION=192.168.0.5 4130 195.10.244.213 22
PS1=#
PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/X11R6/bin:/usr/local/bin
SHELL=/bin/sh
USER=me
...bla bla bla...

It's got USER right, but I would also expect to see the PATH set by 'system' 
printed, but instead I get the PATH set by 'default'. Same goes for SHELL.

Any ideas why I don't get the (well, my !) expected result or am I just 
completely misunderstanding something here ?

regards,

Rich.