Fedora This forum is for the discussion of the Fedora Project. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
11-12-2004, 10:05 PM
|
#1
|
Senior Member
Registered: Apr 2003
Posts: 3,695
Rep:
|
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
|
|
|
11-12-2004, 10:21 PM
|
#2
|
Senior Member
Registered: Jan 2003
Location: Kansas City, Missouri, USA
Distribution: Ubuntu
Posts: 1,040
Rep:
|
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.
|
|
|
11-13-2004, 01:58 AM
|
#3
|
Member
Registered: Apr 2002
Posts: 84
Rep:
|
try su'ing this way: 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!
|
|
|
11-13-2004, 02:55 AM
|
#4
|
Member
Registered: Nov 2003
Distribution: Fedora Core 6
Posts: 76
Rep:
|
For what it's worth, on my FC2 install visudo is located in /usr/sbin. You might look there.
|
|
|
11-19-2004, 12:50 AM
|
#5
|
Senior Member
Registered: Apr 2003
Posts: 3,695
Original Poster
Rep:
|
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
|
|
|
11-19-2004, 04:26 AM
|
#6
|
Member
Registered: Apr 2002
Posts: 84
Rep:
|
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 -- you will see the uid and gid associated with the files, instead of the human-friendly words.
Good luck, satimis!
|
|
|
11-24-2004, 09:58 PM
|
#7
|
Senior Member
Registered: Apr 2003
Posts: 3,695
Original Poster
Rep:
|
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
|
|
|
All times are GMT -5. The time now is 03:54 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|