accetto / ubuntu-vnc-xfce-g3

Headless Ubuntu/Xfce containers with VNC/noVNC (G3v6).
MIT License
214 stars 62 forks source link

Disable VNC Password #6

Closed ymoreiratiti closed 3 years ago

ymoreiratiti commented 3 years ago

How can i disable the VNC password?

accetto commented 3 years ago

Hi,

it would be possible by providing an empty password to docker run, something like this:

docker run -e VNC_PW="" ...

However, in the current version is the password enforced by the code in the file docker\xfce\src\startup\vnc_startup.rc. You would need to remove the line || [ -z "${VNC_PW}" ] \ from the following block of code (starting at line #18) and to build your own image:

### VNC requirements
    if [ -z "${DISPLAY}" ] \
    || [ -z "${VNC_PORT}" ] \
    || [ -z "${VNC_PW}" ] \
    || [ -z "${VNC_COL_DEPTH}" ] \
    || [ -z "${VNC_RESOLUTION}" ] ; then
        cleanup "ERROR: Not all required environment variables are set: DISPLAY, VNC_PORT,VNC_PW, VNC_COL_DEPTH, VNC_RESOLUTION"
    fi

Maybe I could remove this enforcement by default and rebuild the images on Docker Hub.

Why do you want to use it without a password? It would be less secure.

Regards, accetto

accetto commented 3 years ago

One more thing...

Please be aware that even if you will set the VNC password to an empty one, as it has been described above, the password for sudo will still be set to headless. If you want to change also that one, then you would need to change the line VNC_PW=${ARG_VNC_PW:-headless} \ in the following part of the Dockerfile (starting at line #223):

RUN \
    chmod 664 /etc/passwd /etc/group \
    && echo "headless:x:1001:0:Default:${HOME}:/bin/bash" >> /etc/passwd \
    && adduser headless sudo \
    && echo "headless:${VNC_PW}" | chpasswd \
    && ${ARG_FEATURES_USER_GROUP_OVERRIDE/*/chmod a+w /etc/passwd /etc/group} \
    && chmod +x "${STARTUPDIR}"/*.sh \
    && "${STARTUPDIR}"/set_user_permissions.sh "${STARTUPDIR}" "${HOME}"

However, the sudo password must not be empty and you cannot change it simply by docker run, because its default value is embedded into the image. If you want to change it, you have to re-build the image. You can change it afterwards inside the container, of course.

ymoreiratiti commented 3 years ago

I like to use without password because it will run inside a VPN and protected by a LDAP password. So the vnc password became redundant.

Currently i'm extending this image using a Dockerfile and installing the apps we will need

accetto commented 3 years ago

I see. I think I can remove the enforcement and publish a new release. The images on Docker Hub will be re-built automatically. They should be available soon.

ymoreiratiti commented 3 years ago

I've try with the new version and keep asking for password. It's possible to activate the autoconnect to not open the password screen?

docker run -P -e VNC_PW="" -p 26901:6901 accetto/ubuntu-vnc-xfce-g3
accetto commented 3 years ago

Sorry @ymoreiratiti, it seems I've missed your last comment.

It's possible to activate the autoconnect to not open the password screen?

I'm afraid not, if you use the TigerVNC Viewer. At least not that I would know.

However, by noVNC access you can put your password into the link. Something like this:

http://mynas:26901/vnc_lite.html?password=headless http://mynas:26901/vnc.html?password=headless

In that case you should not be prompted for the password.

hina-shah commented 11 months ago

I would like the functionality for not using the password as well. Is there any update for this?