determining sudo access

Donald Russell russell.don at gmail.com
Wed Jan 19 22:34:55 UTC 2011


In /etc/profile.d/local.sh I'd like to modify the PATH env variable to
include /sbin /usr/sbin and /usr/local/sbin but only if the user has sudo
access.

I can use sudo -l  but that prompts for the user password unless the user is
configured for NOPASSWD in sudo.

Is there a reasonably convenient way to do this? I suppose I could just
always included those directories at the end of the PATH... then if users
try a restricted command they'll get "requires root" instead of "command not
found".

What do other people do?

Ideally this should work via ssh as well

i.e. from one machine to another I often do something like
ssh -t <machine> sudo sysctl -a

Which fails unless the path is set correctly on the remote machine...
otherwise I have to specify the full path for sudo and sysctl.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.fedoraproject.org/pipermail/users/attachments/20110119/d3c5840c/attachment.html 


More information about the users mailing list