mirror of
https://github.com/jupyter/docker-stacks.git
synced 2025-10-19 07:52:56 +00:00
improve secure_path modification by storing in sudoers.d
This commit is contained in:
@@ -17,7 +17,7 @@ if [ $(id -u) == 0 ] ; then
|
|||||||
# Handle username change. Since this is cheap, do this unconditionally
|
# Handle username change. Since this is cheap, do this unconditionally
|
||||||
echo "Set username to: $NB_USER"
|
echo "Set username to: $NB_USER"
|
||||||
usermod -d /home/$NB_USER -l $NB_USER jovyan
|
usermod -d /home/$NB_USER -l $NB_USER jovyan
|
||||||
|
|
||||||
# Handle case where provisioned storage does not have the correct permissions by default
|
# Handle case where provisioned storage does not have the correct permissions by default
|
||||||
# Ex: default NFS/EFS (no auto-uid/gid)
|
# Ex: default NFS/EFS (no auto-uid/gid)
|
||||||
if [[ "$CHOWN_HOME" == "1" || "$CHOWN_HOME" == 'yes' ]]; then
|
if [[ "$CHOWN_HOME" == "1" || "$CHOWN_HOME" == 'yes' ]]; then
|
||||||
@@ -60,7 +60,7 @@ if [ $(id -u) == 0 ] ; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Add $CONDA_DIR/bin to sudo secure_path
|
# Add $CONDA_DIR/bin to sudo secure_path
|
||||||
sed -ri "s#Defaults\s+secure_path=\"([^\"]+)\"#Defaults secure_path=\"\1:$CONDA_DIR/bin\"#" /etc/sudoers
|
sed -r "s#Defaults\s+secure_path=\"([^\"]+)\"#Defaults secure_path=\"\1:$CONDA_DIR/bin\"#" /etc/sudoers | grep secure_path > /etc/sudoers.d/path
|
||||||
|
|
||||||
# Exec the command as NB_USER with the PATH and the rest of
|
# Exec the command as NB_USER with the PATH and the rest of
|
||||||
# the environment preserved
|
# the environment preserved
|
||||||
|
Reference in New Issue
Block a user