devcontainers / devcontainers/images
Rust: Permissions Question
- Dominant language
- Shell
- Stars
- 2.1k
- Forks
- 963
- Avg merge
- 7h 48m
- Merged PRs (30d)
- 11
Description
## Scenario
The rust image currently has `umask 022` set.
```shell
$ docker run -it --rm --user root mcr.microsoft.com/devcontainers/rust:1-1-bullseye
root ➜ / $ umask
0022
root ➜ / $ grep ^rustlang /etc/group
rustlang:x:999:vscode
```
Should a build step, such as a _feature_ use `cargo install` the resulting permissions prevent group write usage.
```shell
root ➜ / $ cargo install --quiet bacon
root ➜ / $ ls -ld $CARGO_HOME/registry
drwxr-sr-x 5 root rustlang 4096 Nov 14 19:04 /usr/local/cargo/registry
```
Which then in turn breaks user-level usage of other cargo commands.
```shell
root ➜ / $ su vscode
vscode ➜ / $ cd
vscode ➜ ~ $ cargo install cargo-watch
Updating crates.io index
Downloaded cargo-watch v8.4.1
error: failed to download replaced source registry `crates-io`
Caused by:
failed to open `/usr/local/cargo/registry/cache/index.crates.io-6f17d22bba15001f/cargo-watch-8.4.1.crate`
Caused by:
Permission denied (os error 13)
```
## Question
What is the correct course of action?
1. Set `umask 002` here, at the image level? Perhaps in `/etc/profile`?
2. Set `umask 002` inside feature `install.sh` scripts?
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.