mirror of
https://github.com/linuxserver/docker-code-server
synced 2025-06-26 18:27:40 +00:00
Don't try and enable sudo if ro/non-root even if set
This commit is contained in:
parent
a7e2b20ca2
commit
a7294dfb09
@ -85,7 +85,7 @@ This image can be run with a read-only container filesystem. For details please
|
||||
### Caveats
|
||||
|
||||
* `/tmp` must be mounted to tmpfs
|
||||
* sudo will not be available
|
||||
* `sudo` will not be available
|
||||
|
||||
## Non-Root Operation
|
||||
|
||||
@ -93,7 +93,7 @@ This image can be run with a non-root user. For details please [read the docs](h
|
||||
|
||||
### Caveats
|
||||
|
||||
* sudo will not be available
|
||||
* `sudo` will not be available
|
||||
|
||||
## Usage
|
||||
|
||||
|
@ -39,10 +39,10 @@ opt_param_env_vars:
|
||||
readonly_supported: true
|
||||
readonly_message: |
|
||||
* `/tmp` must be mounted to tmpfs
|
||||
* sudo will not be available
|
||||
* `sudo` will not be available
|
||||
nonroot_supported: true
|
||||
nonroot_message: |
|
||||
* sudo will not be available
|
||||
* `sudo` will not be available
|
||||
# application setup block
|
||||
app_setup_block_enabled: true
|
||||
app_setup_block: |
|
||||
|
@ -3,18 +3,20 @@
|
||||
|
||||
mkdir -p /config/{extensions,data,workspace,.ssh}
|
||||
|
||||
if [[ -n "${SUDO_PASSWORD}" ]] || [[ -n "${SUDO_PASSWORD_HASH}" ]]; then
|
||||
echo "setting up sudo access"
|
||||
if ! grep -q 'abc' /etc/sudoers; then
|
||||
echo "adding abc to sudoers"
|
||||
echo "abc ALL=(ALL:ALL) ALL" >> /etc/sudoers
|
||||
fi
|
||||
if [[ -n "${SUDO_PASSWORD_HASH}" ]]; then
|
||||
echo "setting sudo password using sudo password hash"
|
||||
sed -i "s|^abc:\!:|abc:${SUDO_PASSWORD_HASH}:|" /etc/shadow
|
||||
else
|
||||
echo "setting sudo password using SUDO_PASSWORD env var"
|
||||
echo -e "${SUDO_PASSWORD}\n${SUDO_PASSWORD}" | passwd abc
|
||||
if [[ -z ${LSIO_NON_ROOT_USER} ]] && [[ -z ${LSIO_READ_ONLY_FS} ]]; then
|
||||
if [[ -n "${SUDO_PASSWORD}" ]] || [[ -n "${SUDO_PASSWORD_HASH}" ]]; then
|
||||
echo "setting up sudo access"
|
||||
if ! grep -q 'abc' /etc/sudoers; then
|
||||
echo "adding abc to sudoers"
|
||||
echo "abc ALL=(ALL:ALL) ALL" >> /etc/sudoers
|
||||
fi
|
||||
if [[ -n "${SUDO_PASSWORD_HASH}" ]]; then
|
||||
echo "setting sudo password using sudo password hash"
|
||||
sed -i "s|^abc:\!:|abc:${SUDO_PASSWORD_HASH}:|" /etc/shadow
|
||||
else
|
||||
echo "setting sudo password using SUDO_PASSWORD env var"
|
||||
echo -e "${SUDO_PASSWORD}\n${SUDO_PASSWORD}" | passwd abc
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user