[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: How to hibernate from the command line without typing password

Celejar schreef:
On Tue, 8 Dec 2009 11:02:11 +0000
chombee <chombee@lavabit.com> wrote:

On Sun, Dec 06, 2009 at 02:10:38PM -0500, Celejar wrote:
On Sun, 6 Dec 2009 14:57:21 +0000
chombee <chombee@lavabit.com> wrote:


Gnome desktop. You can send a signal via dbus asking for the computer to
be hibernated with the following command:

    dbus-send --session --dest=org.freedesktop.PowerManagement --type=method_call /org/freedesktop/PowerManagement org.freedesktop.PowerM    anagement.Hibernate

I also saved the command as an executable script called 'hibernate' so
that I can hibernate from the command line by just typing hibernate.
I don't recall the earlier thread, but what's wrong with the
'hibernate' command from the 'acpi-support' package, or 's2disk' from
the 'usswsusp' package?
I have acpi-support installed but don't seem to have a hibernate
command, could take a closer look at the package I guess. I also have

Sorry, my mistake - it's in the package 'hibernate'.

usswsusp installed but I think the s2disk command must be run with sudo,
so you have to type your password.

Of course it must be run as root - why would a linux system allow an
arbitrary user the power to suspend the system!  If you want to avoid
typing a password, then you need to configure sudo to allow your user
to use that command without a password.  This is what Xfce, for
example, recommends:


"I'm unable to shutdown or restart my computer when running Xfce.

There are two way to fix this: sudo and hal/dbus. Default starting from
version 4.4 is hal.
As you can see above, the dbus method that you're using also requires a
dbus policy + adding yourself to a specific group.
If the dbus is set up correctly (eg, you can use hibernate as a user using one of the guis) this should also work: 'dbus-send --session --dest=org.freedesktop.PowerManagement --type=method_call /org/freedesktop/PowerManagement org.freedesktop.PowerManagement.Hibernate'

but of course 'sudo s2disk' is a lot less typing ;)


Attachment: signature.asc
Description: OpenPGP digital signature

Reply to: