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 -- We cannot do everything at once, but we can do something at once. -- Calvin Coolidge (1872-1933), 30th president of the United States -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available URL: <http://lists.centos.org/pipermail/centos/attachments/20100122/5a15476b/attachment-0001.sig>
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 at centos.org [mailto:centos-bounces at 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 $PATHenvironment?> 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 -- We cannot do everything at once, but we can do something at once. -- Calvin Coolidge (1872-1933), 30th president of the United States
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 at centos.org > http://lists.centos.org/mailman/listinfo/centos > >
It's right, adding path into .bash_profil is so easy... ------Original Message------ From: Ga?l Honorez Sender: centos-bounces at centos.org To: CentOS mailing list ReplyTo: CentOS mailing list Subject: Re: [CentOS] Add /sbin to sudo PATH Sent: Jan 22, 2010 8:44 PM 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 at centos.org > http://lists.centos.org/mailman/listinfo/centos > >_______________________________________________ CentOS mailing list CentOS at centos.org http://lists.centos.org/mailman/listinfo/centos Regards, David -- http://pnyet.web.id
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 > SamI 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 at mindless.com -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/x-pkcs7-signature Size: 3274 bytes Desc: S/MIME Cryptographic Signature URL: <http://lists.centos.org/pipermail/centos/attachments/20100122/351cfec6/attachment-0001.bin>