How to configure a password for VNC started from lightdm

Asked by hdb3 on 2012-09-23

I have configured lightdm to start a VNC server using the lightdm.conf lines:
  [VNCServer]
  enabled=true
and I see using netstat and by tailing /var/log/lightdm/lightdm.log that lightdm is listening on port 5900 and receives a connection and starts Xvnc. But the connection fails, according to the client because "No password configured for VNC Auth".

Please advise how to either configure a password or disable use of password in this case?

I am using Ubuntu Desktop 12.04 and have installed x11vnc and vnc4server. I can connect with VNC using a server started manually or as an upstart job.

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu lightdm Edit question
Assignee:
No assignee Edit question
Solved by:
hdb3
Solved:
2012-09-30
Last query:
2012-09-30
Last reply:
2012-09-24

What do you use VNC for? There may be a sleeker solution to what you are doing on the remote system than VNC

hdb3 (p04cs2xjn) said : #2

Hmm - it is a general purpose machine which I use for long running tasks, mostly media related but also an email client which has lots of filters which mean that my mobile email clients don't get clogged up with spam and less interesting mails. VNC has the benefit that I can drop a connection and work goes on. I use ssh and screen for CLI but unless I am missing something VNC is the only option to allow non-disruptive disconnections.

The reason for the question is at least partly to support the community - I can kludge a solution ( I have) - but given that lightdm is the current default DM and that VNC support is supposed to work 'out of the box' it seems to me that this is a question which needs answering. I have spent a little time searching for documentation generally on lightdm and I have found precious little.

If I can solve this one I will be glad to write it up and contribute it back to the community.

Thats cool. I always ask. Lots of people automatically reach for VNC for remote access and a lot of times its not needed :)

hdb3 (p04cs2xjn) said : #4

Thanks for confirming that it's probably a valid question!

https://wiki.archlinux.org/index.php/X11vnc#Setting_a_password

Seems to say that you need to set the password file when it gets ran

hdb3 (p04cs2xjn) said : #6

Yup. I'd agree with that. I've put a valid passwd file in a few places. No luck.

I don't know if this will work for you or not (I use Xubuntu). After much searching on the internet someone posted this answer (if I could recall where who it was I'd give them credit).

To get X11VNC to start on boot and allow you to log into lightdm via the VNC, create a file in /etc/init called x11vnc.conf

In the file put the following;

start on login-session-start
script
x11vnc -shared -loop -xkb -noxrecord -noxfixes -noxdamage -display :0 -auth /var/run/lightdm/root/:0 -forever -bg -o /var/log/x11vnc.log
end script

The next time that the machine starts, it will start the x11vnc server.

hdb3 (p04cs2xjn) said : #8

Thanks for this however it is not the solution I am looking for - it only starts a VNC session for a preexisting X session. lightdm can do this itself - but without piggybacking an existing session (esp. useful if the real session is doing something else already). only challenge is how to set the password when there is no associated login.

Sorry I didn't understand exactly where you were being prompted for the password. My only other suggestion would be to review the /etc/alternatives/vncserver script and comment out the $RFBAUTH= line or reassign it to look elsewhere.

hdb3 (p04cs2xjn) said : #10

I've done a little more investigation.
It seems from reading the source that lightdm invokes Xvnc directly, so attempts to change it's behaviour with configuration files and script wrappers are unlikely to succeed.
I found that depending on _which_ Xvnc is installed behaviour is different.
I started with the Xvnc bundled with vnc4server.
Using this Xvnc I don't believe that without modifying lightdm itself that Xvnc can be configured to work at all - because this Xvnc defaults to use of VNCauth and has no default location for the passwd file.
When I switched to tightvnc server for Xvnc I see different behaviour - it looks as if this Xvnc is reading xorg.conf and thus finding my addition --> Option "SecurityTypes" "None".
Or maybe for another reason, but it allows me to logon to the VNC server started by lightdm.

At this stage I am halting - I got it to work - apparently by installing tightvnc in place of vnc4, and possibly also needing the xorg.conf change I mention. If the lightdm maintainers are interested I would suggest that they document which Xvnc is tested and how the rfbauth options are configured.

rgds

nic