This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Suspend to Ram lock screen

3

Votes
3
0
Tags: None
(comma "," separated)
vahid
Registered Member
Posts
32
Karma
0

Suspend to Ram lock screen

Sat Jun 20, 2009 4:23 am
In powerdevil or system settings advanced power management there is option to lock screen on resume this is ticked but only mode of suspend which I have seen lock is when i shut lid and configured it to suspend to RAM.

Besides this all other modes goes back main screen this is great until the day you decide you wish to have it locked

I been fiddling at first I thought it was /etc/acpi/sleep.d etc..

but kde 4.2 uses pm-tools

so here is a quick hack to make it lock screen on any mode of suspend
At the bottom of /etc/pm/sleep.d/action_wpa add:
/home/YOUR_USERNAME/scripts/disable-screen.sh

tail -4 /etc/pm/sleep.d/action_wpa

wpa_cli -i "${IFACE}" "${COMMAND}"
done
/home/USERNAME/scripts/disable-screen.sh

Put below content starting with bin sh line as file line of script chmod to 755
~/scripts# cat disable-screen.sh
#!/bin/sh
user=`env|grep HOME|awk -F"/" '{print $NF}'`
su - $user -c "export DISPLAY=:0.0;qdbus org.kde.screensaver /ScreenSaver Lock ; xset dpms force off"


#####

so long as the path is corret and action_wpa can see this script and it is exectuable

upon next resume after a suspend you will need a password.
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS

RE: Suspend to Ram lock screen

Sat Jun 20, 2009 8:36 am
Warning to all users who try the above workaround:
It introduces a root level exploit to your system as the script /home/$USER/scripts/disable-screen.sh will be run by the suspend system as root. This script will be editable by users, and therefore represents a security vulnerability.


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
vahid
Registered Member
Posts
32
Karma
0

RE: Suspend to Ram lock screen

Sat Jun 20, 2009 11:41 am
bcooksley wrote:Warning to all users who try the above workaround:
It introduces a root level exploit to your system as the script /home/$USER/scripts/disable-screen.sh will be run by the suspend system as root. This script will be editable by users, and therefore represents a security vulnerability.


ok.. I also found the $user does not work - shame so if it is only your Desktop i.e. not shared with other users.. so the fix which leaves no issues as explained in the above post is:;..

sudo vi /etc/pm/sleep.d/action_wpa

su - YOUR_USERNAME -c "export DISPLAY=:0.0;qdbus org.kde.screensaver /ScreenSaver Lock ; xset dpms force off"
vahid
Registered Member
Posts
32
Karma
0

RE: Suspend to Ram lock screen

Sat Jun 20, 2009 2:26 pm
I have tested below with different users and it seems to be working so it locks screen per user..
(There maybe many easier ways of finding current user logged into X - you could use either below..)

cat /etc/pm/sleep.d/action_wpa |tail -3
user=`who -s|awk '{print $1" "$2}'|grep ":0"|awk '{print $1}'`
#user=`ps aux|grep startkde|grep "/bin/sh"|awk '{print $1}'`

su - $user -c "export DISPLAY=:0.0;qdbus org.kde.screensaver /ScreenSaver Lock ; xset dpms force off"
Lukas
Registered Member
Posts
427
Karma
0

Suspend to Ram lock screen

Tue Aug 25, 2009 11:38 pm
Its a workaround/patch, not an idea.

It should be in either tips or bugs areas.


Bookmarks



Who is online

Registered users: Bing [Bot], daret, Google [Bot], sandyvee, Sogou [Bot]