You are not logged in.

#1 2009-08-02 16:09:04

t4k1t
Member
Registered: 2009-07-19
Posts: 123

Can't shutdown as user

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

#2 2009-08-02 16:45:29

heimdal
Member
Registered: 2009-06-25
Posts: 27

Re: Can't shutdown as user

Are you part of the Power group?

Offline

#3 2009-08-02 16:50:01

t4k1t
Member
Registered: 2009-07-19
Posts: 123

Re: Can't shutdown as user

Now I am ;-) but it still won't work.


Who we are is but a stepping stone to what we can become.

Offline

#4 2009-08-02 17:01:42

bernarcher
Forum Fellow
From: Germany
Registered: 2009-02-17
Posts: 2,281

Re: Can't shutdown as user

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

#5 2009-08-02 17:07:40

t4k1t
Member
Registered: 2009-07-19
Posts: 123

Re: Can't shutdown as user

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

#6 2009-08-02 17:23:15

heimdal
Member
Registered: 2009-06-25
Posts: 27

Re: Can't shutdown as user

Is root part of Power? since you are calling SUPER USER DO?

Offline

#7 2009-08-02 17:27:15

t4k1t
Member
Registered: 2009-07-19
Posts: 123

Re: Can't shutdown as user

Yes root is in the power group.


Who we are is but a stepping stone to what we can become.

Offline

#8 2009-08-02 18:11:31

toad
Member
From: if only I knew
Registered: 2008-12-22
Posts: 1,775
Website

Re: Can't shutdown as user

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

#9 2009-08-02 18:16:03

t4k1t
Member
Registered: 2009-07-19
Posts: 123

Re: Can't shutdown as user

I did a logout and login after every change.


Who we are is but a stepping stone to what we can become.

Offline

#10 2009-08-02 18:47:47

Lone_Wolf
Member
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 11,911

Re: Can't shutdown as user

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

#11 2009-08-02 19:34:59

t4k1t
Member
Registered: 2009-07-19
Posts: 123

Re: Can't shutdown as user

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.


Who we are is but a stepping stone to what we can become.

Offline

#12 2009-08-02 20:02:01

loafer
Member
From: the pub
Registered: 2009-04-14
Posts: 1,772

Re: Can't shutdown as user

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

#13 2009-08-03 03:00:31

arunix
Member
From: /home/kurali
Registered: 2009-04-08
Posts: 93

Re: Can't shutdown as user

what about this?

chmod +x /usr/sbin


Minds are like parachutes. They only function when they are open.

Offline

#14 2009-08-03 13:15:32

t4k1t
Member
Registered: 2009-07-19
Posts: 123

Re: Can't shutdown as user

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

#15 2009-08-03 14:36:38

a1ex
Member
From: Germany
Registered: 2007-02-16
Posts: 91

Re: Can't shutdown as user

%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

#16 2009-08-03 18:26:17

Lone_Wolf
Member
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 11,911

Re: Can't shutdown as user

t4k1t wrote:
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

#17 2009-08-03 18:37:00

Crows
Member
From: Wales
Registered: 2008-09-05
Posts: 92

Re: Can't shutdown as user

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

#18 2009-08-03 19:59:56

t4k1t
Member
Registered: 2009-07-19
Posts: 123

Re: Can't shutdown as user

Crows wrote:

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

#19 2009-08-03 21:23:00

Crows
Member
From: Wales
Registered: 2008-09-05
Posts: 92

Re: Can't shutdown as user

t4k1t wrote:
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.

t4k1t wrote:

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

#20 2009-08-04 15:30:11

t4k1t
Member
Registered: 2009-07-19
Posts: 123

Re: Can't shutdown as user

Crows wrote:

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

#21 2009-08-04 15:49:36

bernarcher
Forum Fellow
From: Germany
Registered: 2009-02-17
Posts: 2,281

Re: Can't shutdown as user

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

#22 2009-08-04 16:22:04

t4k1t
Member
Registered: 2009-07-19
Posts: 123

Re: Can't shutdown as user

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

#23 2009-08-04 16:33:17

Crows
Member
From: Wales
Registered: 2008-09-05
Posts: 92

Re: Can't shutdown as user

What do you mean by isn't working? No output at all?

Offline

#24 2009-08-04 16:35:33

t4k1t
Member
Registered: 2009-07-19
Posts: 123

Re: Can't shutdown as user

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

#25 2009-08-04 16:41:50

Crows
Member
From: Wales
Registered: 2008-09-05
Posts: 92

Re: Can't shutdown as user

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

Board footer

Powered by FluxBB