41

I am trying to setup remote desktop sharing for a Ubuntu 22.04 desktop system with the intended purpose of running this system headless without a screen connected.

I am able to successfully VNC to the 22.04 system from Remmina on a different PC using the username and password generated by the Remote Desktop Sharing application, however each time I reboot the 22.04 system this password changes and I need to connect a screen to find out what the password is. How do I stop this from happening? I need VNC access to the 22.04 system with a password that does not ever change.

Thanks.

LRB
  • 411

3 Answers3

29

Well - I can tell you how to fix this one particular way (its the only way I know how) but it will open up another can of worms for you.

The issue is that in Ubuntu 22.04, all the username and passwords for your system are, by default, encrypted with your username's password. That is being stored in what is called the keyring. What is happening is that the VNC server is being loaded without the keyring being unlocked and therefore can't access the stored VNC password (as its encrypted) so it auto generates a new one each time you boot up.

So, if you auto boot up with your user login, during the auto boot up, Ubuntu 22.04 doesn't automatically unlock the keyring. So to fix this, go to Utilities, Password and Keys, right click on Default Keyring, select change password. It will ask for your username password. Enter that. Then for the new password, do not enter one. Leave it blank. It will warn you that all passwords stored on your keyring will become and remain unencrypted. If you can wear that risk, accept that.

Then go back to remote desktop, ensure the password you want is set, and each time you reboot, that password will then remain the same.

Hope that all makes sense :)

Larrikin
  • 303
24

Copying my own answer from another post:

I found an insecure solution to the problem. The typical solution proposed on the internet for this is to set a blank password for the login keyring using the "Passwords and keys" app. This, however, is highly inscure as all the passwords on the device would be stored in plaintext.

What I decided to do instead was to create a new keyring in the "Passwords and keys" app with no password and set it as the default keyring. Then I proceeded to delete the VNC password from the login keyring. Then I rebooted the computer to ensure that the new keyring is the default one. After the reboot, I reentered the VNC password in the screen sharing settings. This would store the VNC password in the new insecure keyring. Then back to "Passwords and keys" app and set the login keyring to default again. Rebooted again and now the VNC password stayed saved and the default keyring was also back to the login keyring, ensuring all future passwords saved on the device will be encrypted.

So in essence, I just reduced the insecurity of saving all the passwords in plaintext to storing just the VNC password in plaintext.

5

I had the same problem and thanks to the explanations I was able to fix it without compromising security. The user was in "auto login" mode and for some reason the remote sharing desktop set as a VNC server on Ubuntu 22.04 was launched before the keyring had a chance to show. As a result the VNC server did not have access to the passwords and created a new random password after each reboot.

I changed the user to not be in auto login mode (Connexion Automatique in French below). After login the keyring runs before the VNC server which enables it to access the password and it is not reset after each reboot.

Screenshot of the user preference panel