LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices



Reply
 
Search this Thread
Old 08-22-2004, 05:53 AM   #1
acbenny
Member
 
Registered: Jul 2004
Posts: 44

Rep: Reputation: 15
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
 
Old 08-22-2004, 06:07 AM   #2
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 65
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
 
Old 08-22-2004, 06:26 AM   #3
acbenny
Member
 
Registered: Jul 2004
Posts: 44

Original Poster
Rep: Reputation: 15
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
 
Old 08-22-2004, 06:36 AM   #4
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 65
What happens if you use the full path:
sudo /sbin/service xinetd restart
 
Old 08-22-2004, 09:28 AM   #5
acbenny
Member
 
Registered: Jul 2004
Posts: 44

Original Poster
Rep: Reputation: 15
Yes, it work Thank you very much !!!
but why I can't go into that path then restart it ?
 
Old 05-07-2008, 06:12 AM   #6
Low_Memory
LQ Newbie
 
Registered: Aug 2006
Posts: 1

Rep: Reputation: 0
Hello,

please note that you can also use sudo -i <command>.
 
Old 05-07-2008, 09:19 PM   #7
chrism01
Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.6, Centos 5.10
Posts: 16,324

Rep: Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041
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).
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to perform an action (a command) on multiple files with the FOR loop? chun-mee Programming 4 08-23-2005 04:11 AM
Sudo, su and root lesleyb Linux - Security 3 10-18-2004 02:36 PM
normal user want to perform "init 6" by using " sudo acbenny Linux - General 3 08-08-2004 08:41 AM
i am getting command not found error when i am trying to perform commands in linux? sunilmuddu Linux - Newbie 7 03-24-2004 01:18 AM
How to perform root actions in Nautilus? therut Linux - Newbie 2 08-19-2003 08:20 AM


All times are GMT -5. The time now is 05:32 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration