Skip to content

Commit 51a093d

Browse files
committed
No default sudo group anymore needed
1 parent a2f1c43 commit 51a093d

File tree

4 files changed

+10
-17
lines changed

4 files changed

+10
-17
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ RUN rm -rf /etc/xdg/autostart/light-locker.desktop /etc/xdg/autostart/xscreensav
141141
RUN usermod -s /usr/sbin/nologin root
142142

143143
## Create worker user (instead of root user)
144-
RUN useradd -G sudo -d /app -s /bin/bash -u 1001 worker
144+
RUN useradd -d /app -s /bin/bash -u 1001 worker
145145
RUN echo "Defaults!/app/setup.sh setenv" >>/etc/sudoers
146146
# Limit the execute of the following commands of the worker user
147147
RUN echo "worker ALL=(root) NOPASSWD:/usr/sbin/service ssh start, /usr/sbin/service dbus start, /usr/sbin/service rsyslog start, /app/setup.sh" >>/etc/sudoers

README.md

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -71,18 +71,17 @@ _Important:_ By default the user can install new software using `apt` (eg. `sudo
7171

7272
You can either change the environment variables using `-e` flag during `docker run` _or_ by changing just the `environment` section in the `compose.yaml` file.
7373

74-
Docker run example, which disables both APT and sudo group: `docker run --shm-size 2g -it -e ALLOW_APT=no -e ALLOW_SUDO=no -p 2222:22 danger89/xfcevdi_x2go:latest`
74+
Docker run example with `-e`, which disables APT and require password for `sudo apt`: `docker run --shm-size 2g -it -e ALLOW_APT=no -e ENTER_PASS=yes -p 2222:22 danger89/xfcevdi_x2go:latest`
7575

7676
Available environment variables::
7777

78-
| Env. variable | Type | Description | Default value |
79-
| ------------- | ------ | ------------------------------------------- | --------------------- |
80-
| `USERNAME` | string | New username | `user` |
81-
| `USER_ID` | string | New User/Group ID | `1000` |
82-
| `PASS` | string | Change password for user | _auto-generated pass_ |
83-
| `ALLOW_APT` | string | User is allowed to use APT commands | `yes` |
84-
| `ENTER_PASS` | string | Require to enter password for sudo commands | `no` |
85-
| `ALLOW_SUDO` | string | Add user to `sudo` group | `yes` |
78+
| Env. variable | Type | Description | Default value |
79+
| ------------- | ------ | --------------------------------------------------- | --------------------- |
80+
| `USERNAME` | string | New username | `user` |
81+
| `USER_ID` | string | New User/Group ID | `1000` |
82+
| `PASS` | string | Change password for user | _auto-generated pass_ |
83+
| `ALLOW_APT` | string | User is allowed to use APT commands | `yes` |
84+
| `ENTER_PASS` | string | Require to enter password for specific APT commands | `no` |
8685

8786
**NOTE 1:** Since [XFCE VDI v2.0](https://hub.docker.com/r/danger89/xfcevdi_x2go/tags), the new user is _only allowed_ to execute `apt` commands as root user. What can be changed on line 60 & 62 in [setup.sh script](scripts/setup.sh) and build your own Docker image.
8887

compose.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ services:
1111
environment:
1212
USERNAME: melroy
1313
PASS: abc
14-
# ALLOW_SUDO: 'no'
14+
# ENTER_PASS: 'yes'
1515
# ALLOW_APT: 'no'
1616
volumes:
1717
# Make home mount persistent across restarts

scripts/setup.sh

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,6 @@ echo 'pref("datareporting.policy.dataSubmissionEnabled", false);' >>/etc/firefox
4242
# Empty firstRun URL
4343
echo 'pref("datareporting.policy.firstRunURL", "");' >>/etc/firefox-esr/firefox-esr.js
4444

45-
## Setting-up access control
46-
GROUP_LIST="x2gouser"
47-
if [ "$ALLOW_SUDO" = "yes" ]; then
48-
GROUP_LIST="$GROUP_LIST,sudo"
49-
fi
50-
5145
# Add new user
5246
useradd -ms /bin/bash -u "$USER_ID" -G "$GROUP_LIST" "$USERNAME"
5347
echo "$USERNAME:$PASS" | chpasswd

0 commit comments

Comments
 (0)