From 4941a6f6c742693752f434acf99ed15160af6f27 Mon Sep 17 00:00:00 2001 From: Doro Wu Date: Tue, 2 May 2017 17:38:25 +0800 Subject: [PATCH] feat: support VNC_PASSWORD --- README.md | 18 ++++++++++++++++++ image/startup.sh | 7 +++++++ 2 files changed, 25 insertions(+) diff --git a/README.md b/README.md index 7990c689..dc1d673b 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,24 @@ Browse http://127.0.0.1:6080/ +Connect with VNC Viewer and protect by VNC Password +================== + +Forward VNC service port 5900 to host by + +``` +docker run -it --rm -p 6080:80 -p 5900:5900 dorowu/ubuntu-desktop-lxde-vnc +``` + +Now, open the vnc viewer and connect to port 5900. If you would like to protect vnc service by password, set environment variable `VNC_PASSWORD`, for example + +``` +docker run -it --rm -p 6080:80 -p 5900:5900 -e VNC_PASSWORD=mypassword dorowu/ubuntu-desktop-lxde-vnc +``` + +A prompt will ask password either in the browser or vnc viewer. + + Troubleshooting ================== diff --git a/image/startup.sh b/image/startup.sh index 9ba357e5..c15fec4f 100755 --- a/image/startup.sh +++ b/image/startup.sh @@ -12,6 +12,13 @@ chown -R ubuntu:ubuntu /home/ubuntu sudo -u ubuntu -i bash -c "mkdir -p /home/ubuntu/.config/pcmanfm/LXDE/ \ && cp /usr/share/doro-lxde-wallpapers/desktop-items-0.conf /home/ubuntu/.config/pcmanfm/LXDE/" +if [ -n "$VNC_PASSWORD" ]; then + echo -n "$VNC_PASSWORD" > /.password1 + x11vnc -storepasswd $(cat /.password1) /.password2 + chmod 400 /.password* + sed -i 's/^command=x11vnc.*/& -rfbauth \/.password2/' /etc/supervisor/conf.d/supervisord.conf +fi + cd /usr/lib/web && ./run.py > /var/log/web.log 2>&1 & nginx -c /etc/nginx/nginx.conf exec /bin/tini -- /usr/bin/supervisord -n