accetto/xubuntu-vnc

Can't change VNC password by `passwd`

Jay54520 opened this issue · 2 comments

it can be changed by the user inside the container using passwd -- https://github.com/accetto/xubuntu-vnc/tree/master/docker/xubuntu-vnc/

For image xubuntu-vnc-novnc-chromium.

  • Run with docker run -p 5901:5901 -p 6901:6901 <instance-id>
  • Enter instance by docker exec -it <instance-id>
  • Update by passwd
  • Stop and rerun docker run -p 5901:5901 -p 6901:6901 <instance-id>
  • VNC password not changed

Thank you for the feedback. I'll check it over weekend.

So, I've checked it and I've found that it works as it should. However, we have to sort out a few misunderstandings here. 😉

There are two different passwords for two different pursposes that have the same default value headless. I've checked the description in the README file and I've also found it confusing. Therefore I've updated the description for the next release I'm preparing just now.

The first password is the VNC user password, which is used for VNC/noVNC connections. It can be changed through the environment variable VNC_PW while creating a container, like:

docker run -dP -e VNC_PW=mynewpwd accetto/xubuntu-vnc

The second password is the application user password, which is used for sudo. This password can be changed inside the container using the passwd command.

However, your test case example is not quite correct.

The <instance-id> should be <image-id-or-image-name> and you would probably get into troubles with the host's ports 5901/6901. If you would create a container abc like this

docker run -d -P --name abc accetto/xubuntu-vnc-novnc

Docker would assing the next free TCP ports to it and you would avoid conflicts. Such a container would also keep running in the background. Then you could connect to it interactively (if you don't want to use VNC viewer or web browser):

docker exec abc bash

Then you could change the application user's password using passwd and test it like, for example

sudo ls

sudo would ask for the password and your new password should work.

Then you could stop the container using docker stop abc and then start it again docker start abc (or just as one command docker restart abc). sudo would still recognize your new password, even after restart.

If you would however, as in your example, use docker run ... again, then you would not start the previous container, but create a new one, which would have the default password value headless, of course.

Note that if you don't use the option --name with run, then Docker creates random names for each container instance. To stop, restart or connect to an existing containers you have to use their names or IDs.

Hopefully it helped.