You are not logged in.

#1 2008-01-07 09:52:21

peque
Member
From: Denmark - Møn
Registered: 2005-06-26
Posts: 441

Adding a user as superuser - give permission to shutdown![Solved]

Hej Forum

I have a whole MythTV under the stairs solution running in my house.
The only thing I'm missing in the end - is the shutdown process.

Caurse of sharing etc - I've made a user called myth which is the user - controlling my MythTV setup.
On the different Frontends I have a buttom called shutdown. But this ain't working. How is the best way to solve this problem?

Since I should be the myth user - I log as myth and calling the script: /usr/bin/mythshutdown:

$ mythshutdown -q
QSettings::sync: filename is null/empty
poweroff: must be superuser.

This returns after giving the command. Is there a way to add the user - so I got the permission to execute this command???
It'll only send the command mythshutdown -q  - su needed that myth user have permission for that command?

Thanks

Last edited by peque (2008-01-07 21:57:33)


Just getting better .... All the time

Offline

#2 2008-01-07 10:34:36

pressh
Developer/TU
From: Netherlands
Registered: 2005-08-14
Posts: 1,719

Re: Adding a user as superuser - give permission to shutdown![Solved]

Configure sudo for your user to allow it to shutdown your computer, and modify /usr/bin/mythshutdown accordingly.

Offline

#3 2008-01-07 10:53:22

peque
Member
From: Denmark - Møn
Registered: 2005-06-26
Posts: 441

Re: Adding a user as superuser - give permission to shutdown![Solved]

Well - My fault!
Mythshutdown is a binary file - so don't have the option for editing this one.

About sudo:
Well have really tried with all combinations from WIKI etc - but without any luck.
Still getting the same error! about must be superuser!

So I would hope a little more advice:
This is what I have tried to change i /etc/sudoers
Uncomment this line (since myth are in users)
%users  localhost=/sbin/shutdown -h now
Uncomment this line( myth are also in wheel)
%wheel       ALL=(ALL) NOPASSWD: SETENV: ALL
and least :
%users  localhost=/usr/bin/mythshutdown -q

But none of these works


Just getting better .... All the time

Offline

#4 2008-01-07 11:09:35

Nihathrael
Member
From: Freising, Germany
Registered: 2007-10-21
Posts: 82
Website

Re: Adding a user as superuser - give permission to shutdown![Solved]

nihathrael reaper = NOPASSWD: /sbin/shutdown

This is what i use for my shutdown. nihathrael being the username and "reaper" the hostname. If you change that to your desired program to run, it should work.


Unknown Horizons - Open source real-time strategy game with the comfy Anno 1602 feeling!

Offline

#5 2008-01-07 11:25:45

dmartins
Member
Registered: 2006-09-23
Posts: 360

Re: Adding a user as superuser - give permission to shutdown![Solved]

If /usr/bin/mythshutdown is a binary file that does all the work then you need to set up sudo to allow the myth user (or a group the user is in) to run /usr/bin/mythshutdown as a superuser.
Once sudo is configured, you need to make your shutdown button run "sudo /usr/bin/mythshutdown"

Offline

#6 2008-01-07 14:23:49

theringmaster
Member
From: Air Force
Registered: 2007-07-16
Posts: 581
Website

Re: Adding a user as superuser - give permission to shutdown![Solved]

dmartins wrote:

If /usr/bin/mythshutdown is a binary file that does all the work then you need to set up sudo to allow the myth user (or a group the user is in) to run /usr/bin/mythshutdown as a superuser.
Once sudo is configured, you need to make your shutdown button run "sudo /usr/bin/mythshutdown"

gpasswd -a user power

that should give them proper permissions.

and for shutting down a computer I like the 'halt' command. It cleanly shuts down all processes first.

Last edited by theringmaster (2008-01-07 14:24:58)


Check me out on twitter!!! twitter.com/The_Ringmaster

Offline

#7 2008-01-07 16:45:09

byte
Member
From: Düsseldorf (DE)
Registered: 2006-05-01
Posts: 2,046

Re: Adding a user as superuser - give permission to shutdown![Solved]

I think the power group is only of relevance for DBUS/HAL-assisted solutions, not for normal poweroff/halt/shutdown.


1000

Offline

#8 2008-01-07 17:20:55

Zer0
Member
From: Windsor, ON, Canada
Registered: 2006-08-25
Posts: 299

Re: Adding a user as superuser - give permission to shutdown![Solved]

1) When you uncomment the wheel line in sudoers.. make sure you add your myth user to the wheel group!
2) Even if you do this the sudo way..  the command to call shutdown will have to be "sudo shutdown" and I'm not sure your frontend button is calling that command.  (I could be wrong though)

Instead of messing with sudo, you could set the SUID permission on the shutdown binary.. I've heard this isn't the safest practice though (just a warning).

chmod u+s /usr/bin/mythshutdown

Last edited by Zer0 (2008-01-07 17:21:47)

Offline

#9 2008-01-07 20:00:28

peque
Member
From: Denmark - Møn
Registered: 2005-06-26
Posts: 441

Re: Adding a user as superuser - give permission to shutdown![Solved]

Well - I tried both ways.
Ended up with editing the /etc/sudoers to allow my user to run to one single command - mythshutdown
And in the configuration for Mythtv - put a sudo in front - that does the trick - so thanks.


Just getting better .... All the time

Offline

Board footer

Powered by FluxBB