3

I have my RasPi connected to my TV and was wondering how I could lock and unlock the gui via SSH.

I disabled the autlogin on boot with purpose and I would like to be forced to connect an Keyboard for the Login.

When I tried google, I found the xset s off and xset s on commands but this seem to have no effect.

Also I installed xscreensaver but I am not sure how I can login in the beginning.

I am using the RP3 with Raspbian and Pixel.

Hope, some of you might help

1 Answer 1

3

Are you trying to kick a user who has a GUI session open, using SSH? In that case

sudo pkill -f lxsession

should do the trick. It will forcibly close the current session and display a new GUI login dialog.

If you want to prevent anyone from logging back on, you could (for example) unload the keyboard driver and disable HDMI after you have killed lxsession.

4
  • Thank you, that was what I am looking for. Do you also know how I start a new session logging another user in over ssh?
    – maltere
    Commented Jan 18, 2017 at 13:24
  • I guess that would be sudo -u username startlxde Commented Jan 18, 2017 at 13:45
  • yes that seems to do something but it throws an error Invalid MIT-MAGIC-COOKIE-1 key** Message: main.vala:99: Session is LXDE ** Message: main.vala:100: DE is LXDE Invalid MIT-MAGIC-COOKIE-1 key (lxsession:4454): Gtk-WARNING **: cannot open display: :0 I tried export DISPLAY=:0; sudo -u pi startlxde
    – maltere
    Commented Jan 18, 2017 at 14:46
  • @MalteReddig You should be able to generate a new key with xauth, however this really begs for a separate question: comments are intentionally short and lack many formatting features. Commented Jan 18, 2017 at 15:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.