File tree Expand file tree Collapse file tree 3 files changed +18
-16
lines changed
root/etc/s6-overlay/s6-rc.d/init-code-server Expand file tree Collapse file tree 3 files changed +18
-16
lines changed Original file line number Diff line number Diff line change @@ -85,15 +85,15 @@ This image can be run with a read-only container filesystem. For details please
8585### Caveats
8686
8787* ` /tmp ` must be mounted to tmpfs
88- * sudo will not be available
88+ * ` sudo ` will not be available
8989
9090## Non-Root Operation
9191
9292This image can be run with a non-root user. For details please [ read the docs] ( https://docs.linuxserver.io/misc/non-root/ ) .
9393
9494### Caveats
9595
96- * sudo will not be available
96+ * ` sudo ` will not be available
9797
9898## Usage
9999
Original file line number Diff line number Diff line change @@ -39,10 +39,10 @@ opt_param_env_vars:
3939readonly_supported : true
4040readonly_message : |
4141 * `/tmp` must be mounted to tmpfs
42- * sudo will not be available
42+ * ` sudo` will not be available
4343nonroot_supported : true
4444nonroot_message : |
45- * sudo will not be available
45+ * ` sudo` will not be available
4646# application setup block
4747app_setup_block_enabled : true
4848app_setup_block : |
Original file line number Diff line number Diff line change 33
44mkdir -p /config/{extensions,data,workspace,.ssh}
55
6- if [[ -n "${SUDO_PASSWORD}" ]] || [[ -n "${SUDO_PASSWORD_HASH}" ]]; then
7- echo "setting up sudo access"
8- if ! grep -q 'abc' /etc/sudoers; then
9- echo "adding abc to sudoers"
10- echo "abc ALL=(ALL:ALL) ALL" >> /etc/sudoers
11- fi
12- if [[ -n "${SUDO_PASSWORD_HASH}" ]]; then
13- echo "setting sudo password using sudo password hash"
14- sed -i "s|^abc:\!:|abc:${SUDO_PASSWORD_HASH}:|" /etc/shadow
15- else
16- echo "setting sudo password using SUDO_PASSWORD env var"
17- echo -e "${SUDO_PASSWORD}\n${SUDO_PASSWORD}" | passwd abc
6+ if [[ -z ${LSIO_NON_ROOT_USER} ]] && [[ -z ${LSIO_READ_ONLY_FS} ]]; then
7+ if [[ -n "${SUDO_PASSWORD}" ]] || [[ -n "${SUDO_PASSWORD_HASH}" ]]; then
8+ echo "setting up sudo access"
9+ if ! grep -q 'abc' /etc/sudoers; then
10+ echo "adding abc to sudoers"
11+ echo "abc ALL=(ALL:ALL) ALL" >> /etc/sudoers
12+ fi
13+ if [[ -n "${SUDO_PASSWORD_HASH}" ]]; then
14+ echo "setting sudo password using sudo password hash"
15+ sed -i "s|^abc:\!:|abc:${SUDO_PASSWORD_HASH}:|" /etc/shadow
16+ else
17+ echo "setting sudo password using SUDO_PASSWORD env var"
18+ echo -e "${SUDO_PASSWORD}\n${SUDO_PASSWORD}" | passwd abc
19+ fi
1820 fi
1921fi
2022
You can’t perform that action at this time.
0 commit comments