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
On Fri, Jan 22, 2010 at 11:54:37AM +0100, 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
"man sudo"; pay particular attention to the "-i" option.
John
Thanks for the quick answer.
sudo -i simulate the initial shell, actually this is not what I'm looking for.
On Debian systems, this is the default behaviour.
Sam
-----Original Message----- From: centos-bounces@centos.org [mailto:centos-bounces@centos.org] On Behalf Of John R. Dennison Sent: Friday, January 22, 2010 12:10 PM To: CentOS mailing list Subject: Re: [CentOS] Add /sbin to sudo PATH
On Fri, Jan 22, 2010 at 11:54:37AM +0100, 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
"man sudo"; pay particular attention to the "-i" option.
John
On Fri, Jan 22, 2010 at 01:19:43PM +0100, Samuel Contesse wrote:
Thanks for the quick answer.
sudo -i simulate the initial shell, actually this is not what I'm looking for.
On Debian systems, this is the default behaviour.
Sudo is meant to follow the user's PATH unless it has been compiled with the SECURE_PATH option. Ubuntu (and I think Debian) may compile with that option. It's not the default compile time option.
Except adding /sbin to the PATH in ~/.bash_profile (still better than in .bashrc), I don't think you have so many solutions.
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 _______________________________________________ CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos
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!