LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   ifconfig command access for sudo (https://www.linuxquestions.org/questions/linux-general-1/ifconfig-command-access-for-sudo-518326/)

vbseeker 01-11-2007 07:17 AM

ifconfig command access for sudo
 
Hi,

I am trying to implement the sudo on the server.
Currently what i did is as follow.

Made a group = operation
added a user to the group = abcd

in the sudo file i have made the following entry

abcd, %operation ALL= NOPASSWD: /sbin/, /usr/sbin/, /bin , /usr/bin

Now if i login to the server as a abcd user. Then i am using the following command to know the ipaddress of the machine.

sudo ifconfig

and i get the following out.

sudo: ifconfig: command not found

Pls let me know how to configure the sudo file so that the abcd user can use the ifconfig command.


Thanks

Anand

Broder 01-11-2007 07:37 AM

As root edit the sudoers file, There should be a line in it somewhere that says something like:

root ALL = (ALL) ALL

so add your user after this line:

abcd ALL = (ALL) ALL

You haven't mentioned your distro but on some distros I think you need to run /sbin/ifconfig as opposed to just ifconfig

Matir 01-11-2007 12:26 PM

Quote:

Originally Posted by Feelda
As root edit the sudoers file, I'm not at my machine at the moment so can't tell you exactly but there should be a line in it somewhere that says something like:

root ALL = (ALL) ALL

so add your user after this line:

abcd ALL = (ALL) ALL

Be careful: this will give the user abcd FULL root access, to all commands.

vbseeker 01-11-2007 12:27 PM

Quote:

Originally Posted by Feelda
As root edit the sudoers file, I'm not at my machine at the moment so can't tell you exactly but there should be a line in it somewhere that says something like:

root ALL = (ALL) ALL

so add your user after this line:

abcd ALL = (ALL) ALL

You haven't mentioned your distro but on some distros I think you need to run /sbin/ifconfig as opposed to just ifconfig


It worked man. Thanks for the help.

Broder 01-12-2007 04:37 AM

Yes, as Matir said, this gives full access. Would suggest reading up on sudoers file. Full access is not always wise as sometimes the hand can be faster than the head and thats when mistakes happen!

mushtaque_asghar 08-12-2011 01:23 AM

Thanks ...
 
Quote:

Originally Posted by vbseeker (Post 2581438)
It worked man. Thanks for the help.

Mushtaq: It works for me also at CentOS v5.5


All times are GMT -5. The time now is 12:25 PM.