On Mon, Dec 11, 2006 at 11:13:08PM -0500, James Turner wrote:
| I've read the apmd and xlock man pages and am having trouble getting xlock
| to start after a resume.  I created the file /etc/apm/resume and chmod
| 755.  But for some reason, it doesn't run on resume.  Permissions are
| root/wheel.  On a weird note, when I ran sudo apmd rather then letting
| apmd start on boot xlock worked but it locked as root and not my logged in
| user.  Does anyone have any suggestions on how to get xlock to start on a
| resume.
|
| The contents of /etc/apm/resume are:
| #!/bin/sh
| xlock -mode matrix

>From your description, I'd say that xlock can not find the DISPLAY
environment variable (only set within X) to run xlock on. Then, when
you start xlock by hand (probably from within X, thus giving it a
valid DISPLAY to connect to), it runs as root simply because apmd runs
as root.

Try putting xidle in your .xinitrc and have that run xlock. xidle then
runs under your own uid and will spawn an xlock owned by you which you
can then unlock using your own password.

An alternative might be to change your script. I have not tested the
following, so it may or may not work :

        #!/bin/sh
        export DISPLAY=:0.0
        sudo -u <yourusernamehere> /usr/X11R6/bin/xlock -mode matrix

I find this, however, to be ugly and not the way things should be
done. Of course, YMMV.

Cheers,

Paul 'WEiRD' de Weerd

--
>++++++++[<++++++++++>-]<+++++++.>+++[<------>-]<.>+++[<+
+++++++++++>-]<.>++[<------------>-]<+.--------------.[-]
                 http://www.weirdnet.nl/

[demime 1.01d removed an attachment of type application/pgp-signature]

Reply via email to