You are not logged in.
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
have you tried logging out then in again for the group change to take effect?
Offline
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
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
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
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
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
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