-
Notifications
You must be signed in to change notification settings - Fork 184
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chown when specifying username in rstudio container #489
Comments
Hi. You seem to be bind-mounting the Windows volumes as well, what if you don't do this? |
Thank you for showing me that @eitsupi. Even completely removing the local Windows volume the problem persists so it is linked to the few TB of data on the cifs volume. I tried mounting the cifs volume within WSL first and then adding the directory to the container as a local volume. This eliminated the need for creating the docker volume beforehand but did not work. Neither mounting before container is created nor mounting after the container is created in WSL resulted in the container having access to the cifs volume. I think this is some problem with permissions but I know that every UID is set to 1000. The cifs volume issue does not seem to be covered in the WSL2 best practices link that you posted but I appreciate the help with the local volume. |
Thanks @ProbablePattern for the report and @eitsupi for the insight on the WSL2 bind mounting. @ProbablePattern not entirely sure I followed your security concern though in maintaining the |
Sorry, @cboettig I should be clear. I am not deploying to the cloud like this because I want to get all the settings down first. Here is a modified example of what I would like to do:
|
@ProbablePattern sure thing, that makes sense. Is the cloud host running WS2L on Windows 10? If it is a Linux-based host, you may not encounter any issues (but do let us know). My 2c though is not to worry about re-mapping the username. For cloud deploy, I do think it's worth considering using a https connection with a reverse proxy like caddy server. This requires you have your own domain name, but is otherwise quite straight forward. I understand rstudio encrypts the user-entered password with client-side javascript, so password authentication over unsecured http ports isn't totally vulnerable, but still https seems like the better choice to me. I'm just an ecologist not a security professional though, so only take that for what it's worth! |
Thank you. I will try getting a dedicated Linux box. |
This is obviously due to the following code, which has nothing to do with bind mounting to the Windows file system, so even if you were to run it on a normal Linux machine that is not WSL2, the same thing would happen. rocker-versioned2/scripts/userconf.sh Lines 61 to 69 in 3456299
I think the solution is to build an overwritten image that replaces the above script with a script that excludes the chown process. Or how about not bind-mounting to docker run -d \
--name Rocker \
--hostname Rocker \
--network bridge \
-e USER=duser \
-e USERID=1000 \
-e PASSWORD=supersecretpassword \
-p 8787:8787 \
-v Array:/array \
rocker/rstudio:latest At first glance, RStudio Server seems to be able to display only files under the home directory, but I think you can open |
I agree that lines rocker-versioned2/scripts/userconf.sh Lines 61 to 69 in 3456299
usermod here to rename the user and avoid copying anything...
|
Sounds like the combination of WSL and crufty config may be to blame. From Linux to Linux, I mount via |
This might shed some light on the issue. I tried @eddelbuettel 's suggestion of specifying -u 1000:1000 and the username change did not work. There was still an rstudio user with uid 1000 and no duser. This occurs whether specifying |
But I think that is indeed a feature of the RStudio container which needs a user to operate client/server. In the simpler edd@rob:~$ docker run --rm -ti -u 1000:1000 -v$PWD:/mnt r-base bash
docker@8a1ebb4700ae:/$ whoami
docker
docker@8a1ebb4700ae:/$ touch /mnt/DontTouchThis
docker@8a1ebb4700ae:/$
exit
edd@rob:~$ ls -l DontTouchThis
-rw-r--r-- 1 edd edd 0 Jul 1 14:36 DontTouchThis
edd@rob:~$ This is useful when you don't want leftovers, even simple things like |
I agree that would be perfect if I didn't need RStudio server. |
I tried @eitsupi suggestion of just mounting elsewhere. This seems to work after running a script under the new username to create symbolic links in the home directory. That allows the userconf.sh script to run fast enough that everything is ready by the time the symbolic links are created in the home directory. This way everything is accessible from the file window on RStudio Server. |
I would like to do away with the username change mechanism. If you change the user name, it is recommended that you build a Dockerfile like the following instead of doing it in the init process of FROM rocker/rstudio:4.2.0
ENV DEFAULT_USER=new_user
RUN usermod -l "$DEFAULT_USER" rstudio \
&& groupmod -n "$DEFAULT_USER" rstudio \
&& usermod -d /home/"$DEFAULT_USER" -m "$DEFAULT_USER" |
I think we used that feature in the derived container we use with RStudio along with the PrarieLearn test / grade mechanism (where the backend user gets created in an underlying container, and this comes second). I presume we could live with a warning (which presumably nobody sees in backend mode...) |
agree with deprecating this. Changing UID makes sense (for volume mapping / permissions) but I don't think there's much purpose in renaming the user. Of course users can create additional users with whatever names they desire, which is often handy in education/training contexts. |
Customizing the username produces a long-running (more than 15 minutes, have not waited until the end) chown process before the rstudio server is started. This appears to be related to the volumes added to the container. Keeping the default user "rstudio" does not cause a problem. The workaround is obviously to just keep the default user which is fine for local insecure containers. Enabling authentication, adding a password, and changing the username would be ideal for cloud deployment but this will not be feasible if using large volumes.
Docker on WSL2 on Windows 10
Host username is huser
Container username is duser
Setup up cifs volume then run container with both local volume and network volume
I am relatively new to docker so I apologize if this is a docker problem rather than an image problem.
The text was updated successfully, but these errors were encountered: