27

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.

1

3 Answers 3

22

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 :)

7
  • 2
    It seems not a good solution, but thanks for the help any way.
    – BrikerMan
    Apr 23, 2022 at 11:11
  • 2
    Thank you, I've spent hours trying to get this working before I found your post! In Ubuntu 22.04 in "Passwords and Keys" the "Default Keyring" is now called just "Passwords".
    – x5657
    May 9, 2022 at 22:34
  • In 22.04 in "Passwords and Keys" the Change Password menu item is under Passwords > Login > Right click menu > Change Password. Aug 23, 2022 at 4:18
  • Unfortunately this suggestion does not work for me. My remote server has only one user name with password. I am not able to remove the current password: the password change menu does not accept an empty password.
    – Jan
    Sep 10, 2022 at 14:02
  • 2
    Fixed it by turning autologon off, removing password from default keyring, editing the password made the rdp entry, adding a new keyring (with password) and setting that one as default. Hope this helps anyone
    – null
    Nov 28, 2022 at 22:20
19

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.

3
  • 1
    Perfect solution for me. Thank you!
    – Tom
    Jun 4, 2023 at 0:45
  • 1
    Great solution, and uses keyrings the way they're supposed to be used. I would mention, that it's not necessary to reboot to insure that the default keyring has been changed - it's effective immediately. So one can run the "Passwords and Keyrings" app, create the Insecure Keyring, set it to default, then go and set the Remote Desktop Sharing password, then return to Passwords and Keyrings and set the defult back to the previous, all without rebooting. Jul 31, 2023 at 17:41
  • I feel so stupid for trying every other possible thing -> installing tightvnc, setting up xfce4. I just wanted to use obs from an orange pi connected to a camcorder, not hookup a keyboard and monitor to do that! tysm for pointing out this solution which keeps the rest of the keyring secure! Feb 15 at 21:09
4

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

4
  • 1
    I've deactivated the auto-login. But when it is not logged-in the connection is rejected. If I type me password and login the other computer can connect
    – MichiBack
    Aug 3, 2022 at 21:40
  • 4
    but how do you RDP into a computer / user that isn't logged in? It's amazing how difficult and insecure running a headless version of Ubuntu is. You have to enable auto login, disable disk encryption, and use a EDID emulator? It's madness. Sep 1, 2022 at 1:23
  • @MichiBack, same issue, when not loggedin VNC and RDP fails...
    – Je Je
    Mar 12, 2023 at 9:09
  • I think this solution is only useful for those people using the machine as a PC. For headless and unattended access use cases, this will likely lock you out after a restart Apr 25, 2023 at 4:11

You must log in to answer this question.

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