6

[Ubuntu 20.04.1 LTS, x64 GNOME 3.36.3]

I keep Screen Sharing turned on on this machine I use for a Pi-hole server. However, every time I reboot, Screen Sharing won't work, and I need to go to the physical PC, disable SC, and then reenable it. Then it is working again. My Screen Sharing settings:

Ubuntu Screen Sharing dialog

Ideas for how to fix this, so I don't need to reset SC after every reboot?

2 Answers 2

4

I found a more secure 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 foture 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.

1
  • This is definitely the best approach just make sure you don't use the same user/password for RDP or VNC as you use to login to ubuntu/gnome (your linux login). Mar 29, 2023 at 6:01
3

Had this problem too and after some research online found this discussion on the bug. Err, well, it's a bug depending on how you look at it. User Onur Samiloglu points out that it is related to the keyring not being unlocked:

I found a workaround.

It seems the keyring is still locked by the time the remote-desktop-daemon is started and hence the VNC server is unable to read the password. When I opened Seahorse, it was saying it's still locked. My GNOME is set up to log in automatically, if that makes a difference.

The reason keyring might not be unlocked is that it is not unlocked on login. Or (like me) you are logging in with a user automatically. They continue with their idea on how to correct the problem (which I have pasted below for historical purposes), but I'm not a fan of this approach personally since it would involve saving a copy of what is likely your login password in clear text. I have an alternative but I would not have been even come close to coming up with it were it not for this user, so: thank you very much Onur Samiloglu for your insight!

The solution I am using is to just remove the password requirement from the keyring (I'm using Ubuntu 21.10). To do this:

  1. Open the "Passwords and Keys" application
  2. Right click on the "Login" keyring and hit "Change password". Example
  3. Enter your password (likely your login password unless you've changed it)
  4. For the new password enter blank -- you should get a warning that the keyring will always be unlocked.
  5. Reboot and re-enable VNC one more time
  6. Reboot once more to make sure it's still working.

As a warning to anyone reading this: if you use the Login keyring to store any other sensitive passwords you will probably want to find another solution as this is definitely not secure. For my purposes, this is perfect as the machine is just used to run Plex really.

Keep in mind that it is not possible using the GUI to enable VNC to work prior to a user signing in to Ubuntu on your Pi; A user must be signed into the desktop environment for VNC to work. This may be possible with another VNC server application or with some configuration to Vino/gnome-remote-desktop that Ubuntu uses (depending on your version of Ubuntu), but I do not know it.

It might be a good idea for you to add your experience to this bug here so that a better solution can be built into future versions of ubuntu: https://bugs.launchpad.net/ubuntu/+source/gnome-remote-desktop/+bug/1928536

Onur Samiloglu's solution:

I'm killing the currently running gnome-keyring-daemon, creating a new daemon as unlocked and then starting it. Then I restart the remote-desktop-daemon and voilà! Remote desktop password is accepted!!!

Commands (executed as the user, not root):

# killall gnome-keyring-daemon
# echo -n "keyringpasswordNOTVNCPASSWORD" | gnome-keyring-daemon -l -d
# gnome-keyring-daemon -s
# systemctl --user restart gnome-remote-desktop

This could be a generic issue with desktop auto login or the keyring unlock in general. The VNC server rejecting the password might be just a symptom rather than the actual bug.

You must log in to answer this question.

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