From f7c196f58bc5887d57b423c3dad33121b872941b Mon Sep 17 00:00:00 2001 From: Valentin Vieriu Date: Tue, 4 Dec 2018 16:59:05 +0100 Subject: [PATCH] allow to run as another user as root --- DEVELOPMENT.md | 1 + Makefile | 7 ++++++- image/startup.sh | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index e7c4ba0..510ae8b 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -5,6 +5,7 @@ make run ``` You can overwrite the local Ubuntu repo using `make LOCALBUILD=de build`. +You can run the image as adifferent user `make CUSTOM_USER=newuser run`. ## develop backend ``` diff --git a/Makefile b/Makefile index 5747f5e..caace9c 100644 --- a/Makefile +++ b/Makefile @@ -4,6 +4,9 @@ REPO ?= dorowu/ubuntu-desktop-lxde-vnc TAG ?= latest IMAGE ?= ubuntu:18.04 LOCALBUILD ?= tw +HTTP_PASSWORD ?= 123456 +CUSTOM_USER ?= ubuntu +PASSWORD ?= ubuntu build: docker build -t $(REPO):$(TAG) --build-arg localbuild=$(LOCALBUILD) --build-arg image=$(IMAGE) . @@ -12,7 +15,9 @@ run: docker run --rm \ -p 6080:80 -p 6081:443 \ -v ${PWD}:/src:ro \ - -e HTTP_PASSWORD=123456 \ + -e HTTP_PASSWORD=$(HTTP_PASSWORD) \ + -e USER=$(CUSTOM_USER) \ + -e PASSWORD=$(PASSWORD) \ --name ubuntu-desktop-lxde-test \ $(REPO):$(TAG) diff --git a/image/startup.sh b/image/startup.sh index 80bcae3..cf4d943 100755 --- a/image/startup.sh +++ b/image/startup.sh @@ -23,7 +23,7 @@ if [ "$USER" != "root" ]; then fi HOME=/home/$USER echo "$USER:$PASSWORD" | chpasswd - cp -r /root/{.gtkrc-2.0,.asoundrc} ${HOME} + cp -r /root/{.config,.gtkrc-2.0,.asoundrc} ${HOME} [ -d "/dev/snd" ] && chgrp -R adm /dev/snd fi sed -i "s|%USER%|$USER|" /etc/supervisor/conf.d/supervisord.conf