Skip to content

Rust: Permissions Question #851

@CodeMan99

Description

@CodeMan99

Scenario

The rust image currently has umask 022 set.

$ 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.

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.

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?

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions