Hello bro!
I recently solved the same issue, unfortunately “Remote Login” due to some peculiarities (probably Wayland) does not work correctly, and after disconnecting from the session your remote desktop is terminated.
Fedora 40 gnome has a second option, called “Desktop Sharing”.
Irony or another peculiarity, but it will not work as long as the desktop is locked.
You must first log into the desktop and after that “Desktop Sharing” will work, but as soon as you lock the desktop, access to the RDP will disappear and you will have to unlock the desktop again.
This will allow you to use a persistent RDP session without terminating the desktop when disconnecting from RDP.
My solution consists of simulating keystrokes and key input.
You connect via ssh, execute the script, give it the password that it must enter, and it enters the password in the GDM lock window and presses enter, after which your screen is unlocked.
For this I use the ydotool.
I created a simple script that I saved on a PC to which I connect via RDP, and run the script from sudo via ssh.
You can use it for your own purposes.
This script must be saved on the PC to which you will connect via RDP.
#!/bin/bash
echo -n "Enter password to unlock screen(for current user): "
read -s PASSWORD
echo
This combination of ESC and Enter keys was chosen through practice.
I don’t think this solution is 100% safe, but for now it’s the only way to get a normal working RDP on Wayland, without using third-party tools.
Also keep in mind that if you log in to the desktop without a password, the password for “Desktop Sharing” will be generated a new one each time.
You need to set a permanent password for your user and make sure that when you start your PC, you do not have automatic screen unlocking.
Another feature, if after turning on the PC you did nothing for several minutes, it will go to sleep (or something else) and the script will not work, you will have to reboot and execute the script within the first minute.
My sleep state is disabled everywhere, I don’t know why the PC can go to sleep BEFORE the first login.