LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Can't perform root command by using Sudo (https://www.linuxquestions.org/questions/linux-general-1/cant-perform-root-command-by-using-sudo-220830/)

acbenny 08-22-2004 04:53 AM

Can't perform root command by using Sudo
 
Hi All, I am using Redhat8 and try to permit root command to user "ken" by using sudo, i have edited visudo and try to test it but fail. What's wrong ?

[root@localhost /]# visudo
# sudoers file.

# Host alias specification

# User alias specification

# Cmnd alias specification

# Defaults specification

# User privilege specification
root ALL=(ALL) ALL
ken ALL=(ALL) ALL

# Uncomment to allow people in group wheel to run all commands
# %wheel ALL=(ALL) ALL

[ken@localhost tracy]$ sudo service xinetd restart
sudo: service: command not found
[ken@localhost tracy]$ sudo init 0
sudo: init: command not found

david_ross 08-22-2004 05:07 AM

That has nothing to do with permissions, the programs just aren't in your path. Try using the full path to the programs.

You can add aditionsal paths to your PATH with:
PATH="/path/to/new/path:"$PATH

acbenny 08-22-2004 05:26 AM

but i have go into the path and try again. Also fail.

[ken@localhost init.d]$ sudo service xinetd restart
Password:
sudo: service: command not found

david_ross 08-22-2004 05:36 AM

What happens if you use the full path:
sudo /sbin/service xinetd restart

acbenny 08-22-2004 08:28 AM

Yes, it work Thank you very much !!!
but why I can't go into that path then restart it ?

Low_Memory 05-07-2008 05:12 AM

Hello,

please note that you can also use sudo -i <command>.

chrism01 05-07-2008 08:19 PM

sudo opens up a new shell with your current path, with elevated privs as per sudoers file.
Normally (and for good security), the current dir (ie '.') is NOT in your path, otherwise a hacked prog in your 'current' dir could be run by you with elevated privs.
Always use full path for cmds called via sudo, or specify the cmd in the sudoers file (better/more secure).


All times are GMT -5. The time now is 09:23 PM.