LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Fedora
User Name
Password
Fedora This forum is for the discussion of the Fedora Project.

Notices


Reply
  Search this Thread
Old 11-12-2004, 10:05 PM   #1
satimis
Senior Member
 
Registered: Apr 2003
Posts: 3,695

Rep: Reputation: 56
Sudo question


Hi folks,

FC2

On running following commands;

$ man visudo
It works

$ su
Password:
# visudo
bash: visudo: command not found

# rpm -qa | grep visudo
# rpm -qa | grep sudoers
both no printout

# rpm -qa | grep sudo*
sudo-1.6.7p5-26

already installed.

# cat /etc/sudoers
Code:
.....
# User privilege specification
root    ALL=(ALL) ALL

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

# Same thing without a password
# %wheel        ALL=(ALL)       NOPASSWD: ALL

# Samples
# %users  ALL=/sbin/mount /cdrom,/sbin/umount /cdrom
# %users  localhost=/sbin/shutdown -h now
Please advise how to run it

TIA

B.R.
satimis
 
Old 11-12-2004, 10:21 PM   #2
jonr
Senior Member
 
Registered: Jan 2003
Location: Kansas City, Missouri, USA
Distribution: Ubuntu
Posts: 1,040

Rep: Reputation: 47
It runs every time you boot. But the way it's set up now the only user given privileges is root. As far as I know, you have to use visudo to change the file--that's what the manual says, anyway. Can you obtain visudo from your installation disks, or maybe download it for your distribution? Then with visudo available, you can refer to the man pages and follow the instructions for adding a user to the sudoers list. It took me a while to figure out the right way, but I got it done eventually.

P. S. Have you tried something like "locate visudo" to see if it's somewhere not in your path? If you just issue the visudo command and the program isn't in your path, it will not be found.


Last edited by jonr; 11-12-2004 at 10:29 PM.
 
Old 11-13-2004, 01:58 AM   #3
growler
Member
 
Registered: Apr 2002
Posts: 84

Rep: Reputation: 15
try su'ing this way:
Code:
/bin/su -
The '-' at the end allows you to inherit root's profile; leaving the '-' off will switch you to root, but you'll still have your own profile ($PATH, etc.). So what's happening is that you are su'ing to root, but visudo is still not in your path. It's here: /usr/sbin/visudo.

Either do a '/bin/su -', or type the full path to visudo once you su to root. then add yourself to the sudoers file.

Another trick I do is make sure that I have the same $PATH variable as root by editing /etc/profile like so:
Code:
# Path manipulation
if [ `id -u` = 0 ] || [ `id -u` = <your uid here> ]; then
Good luck!
 
Old 11-13-2004, 02:55 AM   #4
Sledge
Member
 
Registered: Nov 2003
Distribution: Fedora Core 6
Posts: 76

Rep: Reputation: 15
For what it's worth, on my FC2 install visudo is located in /usr/sbin. You might look there.
 
Old 11-19-2004, 12:50 AM   #5
satimis
Senior Member
 
Registered: Apr 2003
Posts: 3,695

Original Poster
Rep: Reputation: 56
Hi growler,

Tks for your advice.
Quote:
- snip -
Another trick I do is make sure that I have the same $PATH variable as root by editing /etc/profile like so:
Code:
# Path manipulation
if [ `id -u` = 0 ] || [ `id -u` = <your uid here> ]; then
$ cat /etc/profile
Code:
.....
# Path manipulation
if [ `id -u` = 0 ]; then
        pathmunge /sbin
        pathmunge /usr/sbin
        pathmunge /usr/local/sbin
fi
....
...
whether change "if [ `id -u` = 0 ]; then" as
"if [ `id -u` = 0 ] || [ `id -u` = <your uid here> ]; then"

|| = OR ???
your uid here = login ???

TIA

B.R.
satimis
 
Old 11-19-2004, 04:26 AM   #6
growler
Member
 
Registered: Apr 2002
Posts: 84

Rep: Reputation: 15
Quote:
Originally posted by satimis
Hi growler,

Tks for your advice.

<snipped>

whether change "if [ `id -u` = 0 ]; then" as
"if [ `id -u` = 0 ] || [ `id -u` = <your uid here> ]; then"

|| = OR ???
your uid here = login ???

TIA

B.R.
satimis
Yes, || is 'OR'

So you are saying 'if the person logging on has a uid of 0 (ie 'root') OR a uid of x, then give her a $PATH of...'

This way you and root both have the same path, so sudo won't constantly complain about not finding certain executables.

Your 'uid' is the identification number that your system knows you by. your login name is only a human-friendly alias for this number. you can find your uid by looking in the /etc/passwd file. The first number is your user id number, and the 2nd is your group id number. you can see the uid numbers associated with files by typing
Code:
ls -ln
-- you will see the uid and gid associated with the files, instead of the human-friendly words.

Good luck, satimis!
 
Old 11-24-2004, 09:58 PM   #7
satimis
Senior Member
 
Registered: Apr 2003
Posts: 3,695

Original Poster
Rep: Reputation: 56
Hi growler,

Tks for your advice.

Quote:
... The first number is your user id number, and the 2nd is your group id number. ..
$ ls -ln Standard.doc
-rw-rw-r-- 1 500 500 9728 11æ 19 04:00 Standard.doc

What did the third number '0' and '9728' indicate.

B.R.
satimis
 
  


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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Restricting Editing in Sudo (Advanced Sudo Question) LinuxGeek Linux - Software 4 11-04-2006 04:20 PM
sudo mv question howarddevore Linux - General 5 08-16-2005 12:59 PM
sudo question satimis Linux - Software 3 12-07-2004 09:47 AM
Sudo question. wbdune Linux - Newbie 2 10-14-2003 01:40 AM
sudo question darthtux Linux - General 1 06-07-2002 03:27 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Fedora

All times are GMT -5. The time now is 03:54 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
Open Source Consulting | Domain Registration