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

lock all sessions from root

Tags: None
(comma "," separated)
Nikoli
Registered Member
Posts
10
Karma
0
OS

lock all sessions from root

Wed Mar 25, 2009 4:28 pm
I know two ways for locking my KDE 4.2 session from command line:
1) qdbus org.freedesktop.ScreenSaver /ScreenSaver Lock
2) /usr/lib64/kde4/libexec/krunner_lock --blank --forcelock
what are + and - of this commands?

And how can I lock all sessions from bash script with root permissions?
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS

RE: lock all sessions from root

Thu Mar 26, 2009 4:42 am
As far as I am aware, there is no way directly to lock accounts from root, however if you can access the users session bus, then you can issue the above dbus command which will lock their systems.


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
Nikoli
Registered Member
Posts
10
Karma
0
OS

RE: lock all sessions from root

Thu Mar 26, 2009 5:56 am
KDE 3.5 has this feature:
/usr/kde/3.5/bin/dcop --all-users --all-sessions kdesktop KScreensaverIface lock

Are you sure, that it is not ported to current KDE version?
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS

RE: lock all sessions from root

Thu Mar 26, 2009 6:28 am
This feature cannot be easily ported because it involves gaining access to the private D-Bus session buses of all users. This is only possible through sockets which have the permissions 500 ( Read / Write for the owner, Deny for all others )

Therefore it appears that the only way is to write a script which connects to each of the users buses in turn and sends the message using qdbus. The environment variable you need to change is: "DBUS_SESSION_BUS_ADDRESS"
I have a feeling that the GUID value will also need to be determined.

Example:
Code: Select all
DBUS_SESSION_BUS_ADDRESS="unix:abstract=/tmp/dbus-F5mASoXZ9D,guid=1b147d22c6b4ea8ad823916c49ca782d"

Last edited by bcooksley on Thu Mar 26, 2009 6:29 am, edited 1 time in total.


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]


Bookmarks



Who is online

Registered users: Bing [Bot], Evergrowing, Google [Bot], rockscient