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
85
85
### Caveats
86
86
87
87
* ` /tmp ` must be mounted to tmpfs
88
- * sudo will not be available
88
+ * ` sudo ` will not be available
89
89
90
90
## Non-Root Operation
91
91
92
92
This image can be run with a non-root user. For details please [ read the docs] ( https://docs.linuxserver.io/misc/non-root/ ) .
93
93
94
94
### Caveats
95
95
96
- * sudo will not be available
96
+ * ` sudo ` will not be available
97
97
98
98
## Usage
99
99
Original file line number Diff line number Diff line change @@ -39,10 +39,10 @@ opt_param_env_vars:
39
39
readonly_supported : true
40
40
readonly_message : |
41
41
* `/tmp` must be mounted to tmpfs
42
- * sudo will not be available
42
+ * ` sudo` will not be available
43
43
nonroot_supported : true
44
44
nonroot_message : |
45
- * sudo will not be available
45
+ * ` sudo` will not be available
46
46
# application setup block
47
47
app_setup_block_enabled : true
48
48
app_setup_block : |
Original file line number Diff line number Diff line change 3
3
4
4
mkdir -p /config/{extensions,data,workspace,.ssh}
5
5
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
18
20
fi
19
21
fi
20
22
You can’t perform that action at this time.
0 commit comments