0

I'm trying out the RDP functionality of Gnome 45 and I noticed that the local session is not locked automatically when a remote session is active the way it is on Windows. Is it possible to have this behavior?

I'm using Arch Linux with the X display server.

1 Answer 1

0

If you want to lock local session, then you can run the following command to list all sessions and then find out the session ID for that specific session.

$ loginctl list-sessions SESSION UID USER SEAT TTY 7 1000 user1 seat0 tty2 c3 1001 user2 

Now, use the following command to lock that specific session (your local session). In my case, SESSIONID c3 with user2 is created from RDP. I can close local session i.e. 7 (on tty2).

loginctl lock-session SESSIONID 

EDIT1: Automate the above task

  • Edit your /etc/xrdp/startwm.sh file and add these entries after your gnome-session entry and restart the xrdp service.
    sleep 10s sudo loginctl lock-session $(loginctl list-sessions | grep seat0 | awk '{print $1}') 
  • In order to run passwordless sudo command, add the following line to sudo visudo.
    remoteusername ALL=(ALL) NOPASSWD: /usr/bin/loginctl 
    Now, it will enable passwordless sudo for your remote user.

Once your'e in your remote session, it will lock your primary display after 10 seconds.

2
  • If only that could be automated like it is on Windows. Commented Mar 21, 2024 at 12:51
  • @DaveF I've not tested this but it should work. loginctl lock-session $(loginctl list-sessions | grep seat0 | awk '{print $1}') Add this to /etc/xrdp/startwm.sh file after gnome-session entry. It may work, idk. Give it a try. seat0 (in the above command) is generally associated with primary display and should work. Commented Mar 21, 2024 at 13:44

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.