[SOLVED] sudo without password works not for mount/umount
Linux - SecurityThis forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.
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.
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.
I want to grant the rights to run some programs that need root privilegues to my normal user (tobi), using sudo without password authentification for ease of use. And here I am running into problems. To make things clear, here is my sudoers file:
Code:
# /etc/sudoers
#
# This file MUST be edited with the 'visudo' command as root.
#
# See the man page for details on how to write a sudoers file.
#
Defaults env_reset
# Host alias specification
# User alias specification
# Cmnd alias specification
# User privilege specification
root ALL=(ALL) ALL
tobi ALL=NOPASSWD: /usr/bin/xfce4-power-manager
tobi ALL=NOPASSWD: /usr/sbin/poweroff
tobi ALL=NOPASSWD: /usr/sbin/reboot
tobi ALL=NOPASSWD: /usr/sbin/pm-suspend-hybrid
tobi ALL=NOPASSWD: /usr/bin/mount
tobi ALL=NOPASSWD: /usr/bin/umount
# Allow members of group sudo to execute any command
# (Note that later entries override this, so you might need to move
# it further down)
#%sudo ALL=(ALL) ALL
#
#includedir /etc/sudoers.d
The problem is, it works with the commands /usr/bin/xfce4-power-manager and /usr/sbin/pm-suspend-hybrid, but not with the other commands.
For example, if I try
Code:
sudo reboot
it asks for my password and then tells me that I am not allowed to run this program, same with the other programs, except the two mentioned above.
Note for the mount/umount-commands: I work a lot with many different ISO-files, so an approach using fstab will not work for me.
I searched the net and for similar threads here, but found nothing that helped me.
I appreciate if anybody can point me into the right direction what I am making wrong here.
Last edited by TobiSGD; 12-03-2010 at 03:48 PM.
Reason: Problem partially solved.
Take a look at the Tag_Spec section in the sudoers man file.
While what you have may work fine, it isn't quite the format they use.
See if that helps you any.
HTH
Dave
I changed my sudoers file, so that it looks like in the man page described:
Code:
# /etc/sudoers
#
# This file MUST be edited with the 'visudo' command as root.
#
# See the man page for details on how to write a sudoers file.
#
Defaults env_reset
# Host alias specification
# User alias specification
# Cmnd alias specification
# User privilege specification
root ALL=(ALL) ALL
tobi monster = NOPASSWD: /usr/bin/xfce4-power-manager, /usr/sbin/poweroff, /usr/sbin/reboot, /usr/sbin/pm-suspend-hybrid, /usr/bin/mount, /usr/bin/umount
# Allow members of group sudo to execute any command
# (Note that later entries override this, so you might need to move
# it further down)
#%sudo ALL=(ALL) ALL
#
#includedir /etc/sudoers.d
I don't know what happened. In my desperation to get this working I started visudo, deleted the whole content of the sudoers-file and rewrote it. It looks now like this
Code:
Defaults env_reset
# User privilege
root ALL=(ALL) ALL
tobi monster = NOPASSWD: /usr/bin/xfce4-power-manager, /sbin/poweroff, /sbin/reboot, /usr/sbin/pm-suspend-hybrid, /usr/bin/mount, /usr/bin/umount
And suddenly all commands, except mount and umount, worked like a charm. I wonder what was wrong with the old file.
Can anybody help me with the mount and umount command?
P.S.:I changed the title of the thread according to the new situation.
Thanks, I don't know what happened with my eyes and fingers, that I typed the /usr before them and then overlooked it.
Maybe I should sleep a little bit more.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.