rocker-org / rocker-versioned2

Run current & prior versions of R using docker. rocker/r-ver, rocker/rstudio, rocker/shiny, rocker/tidyverse, and so on.
https://rocker-project.org
GNU General Public License v2.0
413 stars 177 forks source link

Group owner not set correctly in home directory #566

Open jwalden opened 1 year ago

jwalden commented 1 year ago

Container image name

rocker/rstudio:latest

Container image digest

rocker/rstudio@sha256:d110bab4d1543aa517f542cbaed32879503ecd7ecff63340a914c182df18b218

What operating system are you seeing the problem on?

Linux

System information

Docker version 20.10.12, build 20.10.12-0ubuntu4 Ubuntu 22.04.1 LTS

Bug description

When setting the USERID and GROUPID environment variables, files in the rstudio user's home directory have the correct user owner but incorrect group owner.

I believe the problem can be fixed by modifying the chown command on line 58 of /rocker_scripts/init_userconf.sh:

chown -R "$USER" /home/"$USER"

so that it sets the group owner as well as the user owner. This is done in later chown command on line 67 of the same file.

How to reproduce this bug?

docker run --env-file .env --mount src=$(pwd),target=/home/rstudio/nb,type=bind rocker/rstudio:latest

The contents of .env are:
USER=rstudio
PASSWORD=changeme
USERID=1001
GROUPID=1001
ROOT=FALSE

Login to the container then list all files in the rstudio user's home directory:

docker exec -it 280c9f984073 /bin/bash
root@280c9f984073:/home/rstudio# ls -la
total 40
drwxr-x--- 1 rstudio    1000 4096 Nov 16 19:14 .
drwxr-xr-x 1 root    root    4096 Nov  3 14:39 ..
-rw-r--r-- 1 rstudio    1000  220 Jan  6  2022 .bash_logout
-rw-r--r-- 1 rstudio    1000 3771 Jan  6  2022 .bashrc
drwxr-xr-x 1 rstudio    1000 4096 Nov  3 14:39 .config
drwxr-xr-x 3 rstudio rstudio 4096 Nov 16 18:57 nb
-rw-r--r-- 1 rstudio    1000  807 Jan  6  2022 .profile
cboettig commented 1 year ago

Good catch. PR welcome!