0

I have a remote Ubuntu device, and I'd like to be able to remote desktop into it after it boots.

So, I went to Settings/Sharing, got asked to specify a password to open the keyring, enabled Remote Desktop, enabled "Enable Legavy VNC protocol", enabled "Remote Control", changed Authentication from some autogenerated password to something I can remember, and I could get a remote connection with remmina.

Then I reboot, try to remote connect - no connection (BIO_read returned a system error 104: Connection reset by peer); then I go to Sharing - and as soon as I get to Sharing, I get asked again about that "keyring" password - once I do that, then I can connect with remmina, but I cannot log in, because the password under "Authentication" got changed again to something random.

Similar problem on Reddit: https://www.reddit.com/r/Ubuntu/comments/13zjqgb/please_help_pulling_my_hair_out_with_trying_to/

How can I prevent this random change and keep my password?

3

1 Answer 1

1

As mentioned in Ubuntu 22.04 remote desktop headless? :

It looks like gnome-remote-desktop runs as a user service, not a system service, so it's not active unless the user logs in. And it starts before the keyring is unlocked, so it creates a new password every time it starts.

So I looked up gnome-remote-desktop, and found https://wiki.gnome.org/Projects/Mutter/RemoteDesktop -> and from there, https://www.mankier.com/1/grdctl

Right after boot, this tools confirms that gnome-remote-desktop is running:

$ grdctl status
RDP:
    Status: enabled
    TLS certificate: /home/user/.local/share/gnome-remote-desktop/rdp-tls.crt
    TLS key: /home/user/.local/share/gnome-remote-desktop/rdp-tls.key
    View-only: no
    Username: (empty)
    Password: (empty)
VNC:
    Status: enabled
    Auth method: prompt
    View-only: no
    Password: (empty)

... so I guess the problem is the keyring.

I've tried the unlock-keyring bash script from https://unix.stackexchange.com/questions/602313/unlock-gnome-keyring-daemon-from-command-line/676655#676655 ; it did not work

Then I tried the .config/autostart/password_fix.desktop from Ubuntu 22.04 remote desktop headless? -> this actually DID work, however right after boot, you get a prompt to enter your password to unlock the keyring, and since this is a PC without keyboard or mouse, it is a PAIN to do that every time; but at least, once that is done, I can get a remote connection over RDP with the login and password I expect.

So the final thing is - how to get rid of that keyring password prompt at start; https://unix.stackexchange.com/questions/684412/is-it-possible-to-permanently-disable-the-gnome-keyring-passphrase notes:

A partial solution to this problem is to set the keyring password to an empty string, by opening the Passwords and Keys app (type keyring into the search bar), and using the menu as below: ...

But is not a very good solution, because the keyring password keeps being reset, and you have to repeat the same process all over again. I am not sure if this happens on some reboots, or when there has been an update.

So, blank password is not really an option either - but eventually, I got to this:

  1. (Remove/disable .config/autostart/password_fix.desktop from above, if used)

  2. Copy the script unlock_keyring.sh from https://unix.stackexchange.com/questions/602313/unlock-gnome-keyring-daemon-from-command-line/602935#602935 on the remote PC; do NOTE that it says: "NOTE: This script will only work if launched via source or ."

Upon fresh reboot of the remote PC, login via ssh, and then:

  1. Call unlock_keyring.sh via sourcing:
$ . unlock_keyring.sh 
NOTE: This script will only work if launched via source or .
Login password: 
$
  1. Call the python3 command, originally in .config/autostart/password_fix.desktop:
$ python3 -c "import keyring;keyring.set_password('login','user','Remmina_Password');"
$

At this point, I can log in over Remmina/RDP to the remote PC - without having to do any GUI operations ...

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .