diff --git a/.env.sample b/.env.sample index cbecb63af1906a8c580718c7f375b38d7f2e0f4a..c04e637e876a70da7ce9fe4d7041a8b343aa59c8 100644 --- a/.env.sample +++ b/.env.sample @@ -21,3 +21,6 @@ SPYDER=true ANACONDA=true # Install QGIS QGIS=true +# Should the user have sudo rights +# **only home is a volume, any modifcation in other FS will be lost** +SUDO=true diff --git a/docker-compose.yml b/docker-compose.yml index f56423cd776bfaf03e198857dc0ba3492e6158ed..4f01aed8cba09294be3944f3f32bccd6e0b71df7 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -16,6 +16,7 @@ services: - QGIS=${QGIS} - ANACONDA=${ANACONDA} - KASM_USER=${VNC_USER} + - SUDO=${SUDO} image: "kasmvnc-ubuntu-noble:spyder-${SPYDER}_anaconda-${ANACONDA}_QGIS-${QGIS}" shm_size: '512m' volumes: diff --git a/docker/kasm/Dockerfile b/docker/kasm/Dockerfile index 8348ce8c78b5a059ace8baa9a02f33dab36baa7e..62ffbed551ffa0e8bd75a22508b7b5d18854ecef 100644 --- a/docker/kasm/Dockerfile +++ b/docker/kasm/Dockerfile @@ -12,6 +12,7 @@ ARG SPYDER ARG QGIS ARG ANACONDA ARG ANACONDA_VERS=Anaconda3-2024.02-1 +ARG SUDO ARG KASM_USER @@ -72,6 +73,15 @@ RUN if [ "$QGIS" = true ] ; then \ COPY custom_startup.sh $STARTUPDIR/custom_startup.sh COPY change_password.sh / +RUN if [ "$SUDO" = true ]; then \ + echo "Defaults lecture_file = /etc/sudoers.lecture" > /etc/sudoers.d/kasm \ + echo "%sudo ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers.d/kasm; \ + usermod -a -G sudo $KASM_USER \ + fi + +COPY lecture /etc/sudoers.lecture + + ######### End Customizations ########### diff --git a/docker/kasm/lecture b/docker/kasm/lecture new file mode 100644 index 0000000000000000000000000000000000000000..9d5ab6879ac6afddb092fd057ac2948ab4049d4a --- /dev/null +++ b/docker/kasm/lecture @@ -0,0 +1,9 @@ +################################### WARNING ################################### + +Although you have root access, any change to the main file system will be +dropped upon container restart. + +If you whish to install new softwares please contact the system administrator +for help. + +###############################################################################