You are not logged in.
Hi,
I just followed the Wiki-Entry on how to make users able to shutdown/reboot the system, but I get the following error:
user /home/user $ sudo halt
sudo: sorry, you are not allowed to preserve the environment
My sudoers file:
Defaults:user timestamp_timeout=0
Defaults insults
root ALL=(ALL) ALL
user ALL=(ALL) ALL
user localhost=NOPASSWD: /sbin/halt
user localhost=NOPASSWD: /sbin/reboot
On my old installation I had this working already, I really appreciate all help.
Who we are is but a stepping stone to what we can become.
Offline
Are you part of the Power group?
Offline
Now I am ;-) but it still won't work.
Who we are is but a stepping stone to what we can become.
Offline
I have
bp ALL=NOPASSWD: /sbin/reboot
bp ALL=NOPASSWD: /sbin/halt
Might be worth a try.
To know or not to know ...
... the questions remain forever.
Offline
Still gives me
sudo: sorry, you are not allowed to preserve the environment
Who we are is but a stepping stone to what we can become.
Offline
Is root part of Power? since you are calling SUPER USER DO?
Offline
Yes root is in the power group.
Who we are is but a stepping stone to what we can become.
Offline
I take it you logged out and in again after having made changes to /etc/group?
never trust a toad...
::Grateful ArchDonor::
::Grateful Wikipedia Donor::
Offline
I did a logout and login after every change.
Who we are is but a stepping stone to what we can become.
Offline
This has worked fine for me in etc/sudoers file for ages :
%powerusers ALL = (root) NOPASSWD: /sbin/poweroff
%powerusers ALL = (root) NOPASSWD: /sbin/reboot
Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.
(A works at time B) && (time C > time B ) ≠ (A works at time C)
Offline
This has worked fine for me in etc/sudoers file for ages :
%powerusers ALL = (root) NOPASSWD: /sbin/poweroff %powerusers ALL = (root) NOPASSWD: /sbin/reboot
Now when I type
sudo reboot
bash prompts me for the password.
Who we are is but a stepping stone to what we can become.
Offline
Type the command "sudo -l" and it will show you what you are allowed to do. There may be another entry overriding it. Try adding the lines as the last entry in sudoers if they are not there already.
All men have stood for freedom...
For freedom is the man that will turn the world upside down.
Gerrard Winstanley.
Offline
what about this?
chmod +x /usr/sbin
Minds are like parachutes. They only function when they are open.
Offline
Hmm when I type
sudo -l
it just gives me the usage description but the command schould work without parameters schouldn't it?
Who we are is but a stepping stone to what we can become.
Offline
%users ALL= NOPASSWD: /usr/sbin/pm-suspend,/usr/bin/netcfg2
from /etc/sudoers works fine here. Just place halt and reboot there.
Or you could chmod +s /sbin/halt and reboot, which allows to execute it as user.
Last edited by a1ex (2009-08-03 14:38:00)
Offline
Lone_Wolf wrote:This has worked fine for me in etc/sudoers file for ages :
%powerusers ALL = (root) NOPASSWD: /sbin/poweroff %powerusers ALL = (root) NOPASSWD: /sbin/reboot
Now when I type
sudo reboot
bash prompts me for the password.
My mistake, those 2 lines in /etc/sudoers give all users that are member of the group powerusers the ability to use those 2 commands
WITHOUT sudo or password .
In other words :
When powerusers enter "reboot" or "shutdown" , it will be executed with root-rights .
Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.
(A works at time B) && (time C > time B ) ≠ (A works at time C)
Offline
2 Suggestions if you haven't got this fixed yet:
A) Are you sure you don't have any PolicyKit/Hal stuff running that could be blocking this?
B) Try sudo shutdown -h now instead?
Offline
A) Are you sure you don't have any PolicyKit/Hal stuff running that could be blocking this?
I don't know, I didn't change any related configs. Is it blocked by default from anything?
Who we are is but a stepping stone to what we can become.
Offline
Lone_Wolf wrote:This has worked fine for me in etc/sudoers file for ages :
%powerusers ALL = (root) NOPASSWD: /sbin/poweroff %powerusers ALL = (root) NOPASSWD: /sbin/reboot
Now when I type
sudo reboot
bash prompts me for the password.
Sorry if I'm insulting your intelligence t4k1t, but is you group named powerusers or power? If it's power then that should be %power on those lines.
It's usually the little mistakes that cause problems like this. I should know, I've made quite a few myself since coming to arch.
Is it blocked by default from anything?
No. I was thinking of the problems you can get into with HAL stopping WMs from shutting down. Shouldn't be the cause, but mentioned it just in case.
Offline
Sorry if I'm insulting your intelligence t4k1t, but is you group named powerusers or power? If it's power then that should be %power on those lines.
Bad enough I have to admit I overlooked that, but with power instead of powerusers it's still not working.
I still get
sudo: sorry, you are not allowed to preserve the environment
Who we are is but a stepping stone to what we can become.
Offline
I did some googeling for this error message and found this discussion. I had no time for thorough reading, however, but it might be worth a try.
To know or not to know ...
... the questions remain forever.
Offline
Hm thanks I read this, but it won't work either.
What really disturbes me is that
sudo -l
isn't working.
Or am I just unable to understand the manpage for sudo?
Who we are is but a stepping stone to what we can become.
Offline
What do you mean by isn't working? No output at all?
Offline
It gives me the description on how to use sudo -l as if I got the syntax wrong, but the command is only
sudo -l
or did I miss smth?
Who we are is but a stepping stone to what we can become.
Offline
It should list the commands you can do as sudo. The only things I can think of are you're running it as root (may make a difference) or you're using a font that make a lower-case L look like a capital I.
My file is set as:
%wheel ALL=(ALL) ALL
%wheel ALL=NOPASSWD: /sbin/shutdown -h now
Of course, that's not too safe if you have a multi-user system. But I dont, so meh.
Offline