Re: Add /sbin to sudo PATH

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



Samuel Contesse wrote:
Hello,

Does anyone have an idee how to add /sbin to the sudo $PATH environment?
Adding /sbin to .bashrc $PATH isn't really what I want...

I'd like sudoers to be able to run:
$ sudo chkconfig
And not:
$ sudo /sbin/chkconfig
Thanks
Sam

I use an alias to handle that.  I put the following line in my .bashrc file:

alias sudo='PATH=$PATH:/usr/kerberos/sbin:/usr/local/sbin:/usr/sbin:/sbin /usr/bin/sudo'

This dynamically adds the desired directories to the path BEFORE executing sudo. The downside is that it won't work in scripts, but I usually set the path explicitly in my scripts anyway.

Hope that helps!
--
Jay Leafey - Memphis, TN
jay.leafey@xxxxxxxxxxxx

<<attachment: smime.p7s>>

_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
http://lists.centos.org/mailman/listinfo/centos

[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux