determining sudo access



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.
--
users mailing list
users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines


Relevant Pages

  • Re: Top Ten Reasons to Not Wait for Vista
    ... how to write a sudo + libgksu clone. ... Sudo only prompts once every five minutes, ... That would then not be a grotesque security hole. ... That works for *building* a market, but not so much for changing a market. ...
    (comp.sys.mac.advocacy)
  • Re: root password prompts
    ... No, I mean sudo. ... When next invoked, sudo checks the latest entry, ... If more than the time limit has elapsed, then it prompts, ...
    (Fedora)
  • Re: root password prompts
    ... for the root password. ... No, I mean sudo. ... If more than the time limit has elapsed, then it prompts, ...
    (Fedora)
  • Re: Top Ten Reasons to Not Wait for Vista
    ... how to write a sudo + libgksu clone. ... Sudo only prompts once every five minutes, ... That works for *building* a market, but not so much for changing a market. ...
    (comp.sys.mac.advocacy)
  • Re: "I wonder if she lets anyone into that island of light?"
    ... but sudo never came my way. ... Basically, "do command as superuser/root". ... Does the system then respond by demanding root ... Actually, it usually demands your user password, and will only allow that ...
    (rec.arts.sf.written)