You are not logged in.

#1 2011-03-25 15:46:33

JMO
Member
From: Argentina
Registered: 2006-04-08
Posts: 98

[SOLVED] Permissions to halt/reboot won't work

Here is my sudoers file:

## sudoers file.
##
## This file MUST be edited with the 'visudo' command as root.
## Failure to use 'visudo' may result in syntax or file permission errors
## that prevent sudo from running.
##
## See the sudoers man page for the details on how to write a sudoers file.
##

##
## Host alias specification
##
## Groups of machines. These may include host names (optionally with wildcards),
## IP addresses, network numbers or netgroups.
# Host_Alias    WEBSERVERS = www1, www2, www3

##
## User alias specification
##
## Groups of users.  These may consist of user names, uids, Unix groups,
## or netgroups.
# User_Alias    ADMINS = millert, dowdy, mikef

##
## Cmnd alias specification
##
## Groups of commands.  Often used to group related commands together.
# Cmnd_Alias    PROCESSES = /usr/bin/nice, /bin/kill, /usr/bin/renice, \
#                           /usr/bin/pkill, /usr/bin/top

##
## Defaults specification
##
## You may wish to keep some of the following environment variables
## when running commands via sudo.
##
## Locale settings
# Defaults env_keep += "LANG LANGUAGE LINGUAS LC_* _XKB_CHARSET"
##
## Run X applications through sudo; HOME is used to find the
## .Xauthority file.  Note that other programs use HOME to find   
## configuration files and this may lead to privilege escalation!
# Defaults env_keep += "HOME"
##
## X11 resource path settings
# Defaults env_keep += "XAPPLRESDIR XFILESEARCHPATH XUSERFILESEARCHPATH"
##
## Desktop path settings
# Defaults env_keep += "QTDIR KDEDIR"
##
## Allow sudo-run commands to inherit the callers' ConsoleKit session
# Defaults env_keep += "XDG_SESSION_COOKIE"
##
## Uncomment to enable special input methods.  Care should be taken as
## this may allow users to subvert the command being run via sudo.
# Defaults env_keep += "XMODIFIERS GTK_IM_MODULE QT_IM_MODULE QT_IM_SWITCHER"
##
## Uncomment to enable logging of a command's output, except for
## sudoreplay and reboot.  Use sudoreplay to play back logged sessions.
# Defaults log_output
# Defaults!/usr/bin/sudoreplay !log_output
# Defaults!/usr/local/bin/sudoreplay !log_output
# Defaults!/sbin/reboot !log_output

##
## Runas alias specification
##

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

## Uncomment to allow members of group wheel to execute any command
 %wheel ALL=(ALL) ALL

# Allowing users in optical group to mount devices

# %optical ALL=(ALL) NOPASSWD: /bin/mount

# Allowing users in power group to suspend to RAM and halt

 %power ALL=(ALL) NOPASSWD: /sbin/halt
 %power ALL=(ALL) NOPASSWD: /sbin/reboot
 %power ALL=(ALL) NOPASSWD: /usr/sbin/pm-suspend

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

## Uncomment to allow members of group sudo to execute any command
# %sudo ALL=(ALL) ALL

## Uncomment to allow any user to run sudo if they know the password
## of the user they are running the command as (root by default).
# Defaults targetpw  # Ask for the password of the target user
# ALL ALL=(ALL) ALL  # WARNING: only use this together with 'Defaults targetpw'

## Read drop-in files from /etc/sudoers.d
## (the '#' here does not indicate a comment)
#includedir /etc/sudoers.d

.
In any of the three cases above I recieve a message saying that I must to be root.

I'm on each of the following groups with my user:

lp wheel games network video audio optical storage power users

What am I missing?

Last edited by JMO (2011-03-25 20:06:32)

Offline

#2 2011-03-25 15:48:17

bohoomil
Member
Registered: 2010-09-04
Posts: 2,376
Website

Re: [SOLVED] Permissions to halt/reboot won't work

Do you precede any of those commands with sudo?


:: Registered Linux User No. 223384

:: github
:: infinality-bundle+fonts: good looking fonts made easy

Offline

#3 2011-03-25 15:50:40

JMO
Member
From: Argentina
Registered: 2006-04-08
Posts: 98

Re: [SOLVED] Permissions to halt/reboot won't work

I don't want to. It is possible to do so?

Offline

#4 2011-03-25 15:51:33

bohoomil
Member
Registered: 2010-09-04
Posts: 2,376
Website

Re: [SOLVED] Permissions to halt/reboot won't work

I don't think so. You have to type sudo before them, but you can work it around by creating an alias for each of them. This way sudo is issued, but as you stated in your sudoers file, the password doesn't have to be typed.

Last edited by bohoomil (2011-03-25 15:52:49)


:: Registered Linux User No. 223384

:: github
:: infinality-bundle+fonts: good looking fonts made easy

Offline

#5 2011-03-25 17:06:50

Marshian
Member
Registered: 2011-03-22
Posts: 1

Re: [SOLVED] Permissions to halt/reboot won't work

It's possible to execute a command as the user who owns the file (see SUID (chmod +s)), which would give you (and any other user!) the required permission to shut down the computer. Then you just need to add an appropriate executable flag to allow you to execute the file.

If it would save you some time: nothing you change about /etc/sudoers will have the effect you desire. Those are only settings for the sudo-command. If you're not using sudo, those settings will not have any effect.

Offline

#6 2011-03-25 20:05:56

JMO
Member
From: Argentina
Registered: 2006-04-08
Posts: 98

Re: [SOLVED] Permissions to halt/reboot won't work

I've never asked myself the question, but is nice to know it. Thanks!
I'll go for the alias solution.-

Offline

Board footer

Powered by FluxBB