You are not logged in.

#1 2006-12-21 21:27:05

stmok
Member
From: Sydney, Australia
Registered: 2006-11-19
Posts: 72

Problem with permissions and hibernate [RESOLVED]

I'm trying to get hibernate working on my ThinkPad for a non-root user.

I've set everything and its working flawlessly (for root), based on this guide.
=> http://wiki.archlinux.org/index.php/Suspend_to_Disk


Now what I've done so far is:

Create a new group called hibernate
=> groupadd hibernate

Change the group of the script hibernate from root to hibernate
=> chgrp hibernate /usr/sbin/hibernate

Change persmissions of the file hibernate to -rwxr-x---
=> chmod 750 /usr/sbin/hibernate

Add normal user funnyfarm23 to group hibernate
=> gpasswd -a funnyfarm23 hibernate

I then create a shortcut in KDE menu pointed to /usr/sbin/hibernate. It doesn't seem to work.

So I then tried hibernate in a console window...
And it says: hibernate: You need to run this script as root

I think I'm still missing something, but I'm not sure what it is. Any ideas?


The most important thing the hacker community does is write better code. Our deeds are the best propaganda we have. -Eric S. Raymond

Offline

#2 2006-12-21 22:22:19

T-Dawg
Forum Fellow
From: Charlotte, NC
Registered: 2005-01-29
Posts: 2,736

Re: Problem with permissions and hibernate [RESOLVED]

have you tried logging out then in again for the group change to take effect?

Offline

#3 2006-12-21 22:54:05

stmok
Member
From: Sydney, Australia
Registered: 2006-11-19
Posts: 72

Re: Problem with permissions and hibernate [RESOLVED]

Yeap.

I tried logging out and back in => No change. Still required root.

I then rebooted the system => Again, no change. Still required root.


The most important thing the hacker community does is write better code. Our deeds are the best propaganda we have. -Eric S. Raymond

Offline

#4 2006-12-22 07:02:01

stmok
Member
From: Sydney, Australia
Registered: 2006-11-19
Posts: 72

Re: Problem with permissions and hibernate [RESOLVED]

Well, the "quick and dirty way", was to use sudo.

In /etc/sudoers, add:
=> %wheel ALL = NOPASSWD: /usr/sbin/hibernate

Running sudo hibernate runs flawlessly for a normal user. Assuming they are in the wheel group.

Yes, I know...Not secure way to do it with no password approach.  :oops:

If there's a better way to do it, I'm all ears.


The most important thing the hacker community does is write better code. Our deeds are the best propaganda we have. -Eric S. Raymond

Offline

#5 2006-12-22 09:35:07

tomk
Forum Fellow
From: Ireland
Registered: 2004-07-21
Posts: 9,839

Re: Problem with permissions and hibernate [RESOLVED]

sudo is the only way I know. The root requirement is hard coded in the script:

EnsureHaveRoot() {
    if [ x"`id -u`" != "x0" ] ; then
        echo "$EXE: You need to run this script as root."
        exit 1
    fi
    return 0
}

so changing the group makes no difference.

Offline

#6 2006-12-22 10:22:07

stmok
Member
From: Sydney, Australia
Registered: 2006-11-19
Posts: 72

Re: Problem with permissions and hibernate [RESOLVED]

OK...Consider this case as solved then.


The most important thing the hacker community does is write better code. Our deeds are the best propaganda we have. -Eric S. Raymond

Offline

#7 2006-12-22 14:05:20

Snarkout
Member
Registered: 2005-11-13
Posts: 542

Re: Problem with permissions and hibernate [RESOLVED]

I'm pretty sure you *can* change group on the suspend2 scripts, though.  IIRC there are actually instructions in the conf files or man pages for this.


Unthinking respect for authority is the greatest enemy of truth.
-Albert Einstein

Offline

#8 2006-12-22 23:52:28

stmok
Member
From: Sydney, Australia
Registered: 2006-11-19
Posts: 72

Re: Problem with permissions and hibernate [RESOLVED]

Yeah, I didn't want to use the "password-less sudo" approach unless I had to...

The closest thing I found related to my issue was here:
http://www.suspend2.net/HOWTO-3.html

If you want users to be able to suspend, use visudo and add the following lines to your /etc/sudoers file, changing the /usr/local/sbin/hibernate to the path it was installed (/usr/sbin/hibernate in the Debian & RPM packages)

Host_Alias LOCALHOST=localhost,<your>
ALL LOCALHOST=NOPASSWD: /usr/local/sbin/hibernate *

See man sudoers(5) for more information. Users will then be able to do sudo /usr/local/sbin/hibernate.

I didn't notice any other related info in their wiki or mailinglist archives, so I guess there's no other choice. (Maybe change the script? ... I have very little experience with bash scripts so I'm not sure what half the stuff means yet.)


The most important thing the hacker community does is write better code. Our deeds are the best propaganda we have. -Eric S. Raymond

Offline

Board footer

Powered by FluxBB