Skip to content

Files Written to Mounted Host Directory Owned by Root User #594

@osterman

Description

@osterman

what

  • The user's shell inside Geodesic runs as root
  • The script that launches Geodesic bind-mounts the host user's $HOME to /localhost to provide access to configuration files and allow for editing of host files
  • Depending on the way Docker is set up, it is possible that files created under /localhost from within Geodesic will be set to the same owner UID and GID (that is, owned by root) on the host as they have within Geodesic.
  • This appears to affect users running the Docker daemon as root under Linux or Windows Subsystem for Linux (WSL). It does not affect Docker for Mac, nor does it affect Docker for Linux when run in "rootless" mode.

Resolution

The recommended solution for Linux users is to run Docker in "rootless" mode. In this mode, the Docker daemon runs as the host user (rather than as root) and files created by the root user in Geodesic are owned by the host user on the host. Not only does this configuration solve this issue, but it provides much better system security overall.

Geodesic, as of v0.151.0, provides an alternative solution: BindFS mapping of file owner and group IDs. To enable this solution in Geodesic v4.0.0 or later, either set the shell environment variable MAP_FILE_OWNERSHIP=true (can be set in launch-options.sh) or launch Geodesic with the command line option --map-file-ownership. (To enable this solution in Geodesic prior to version 4.0.0, either set (and export) the shell environment variable GEODESIC_HOST_BINDFS_ENABLED=true or launch Geodesic with the command line option --geodesic-host-bindfs-enabled.) When this option is enabled, Geodesic will output

# Enabling BindFS mapping of file system owner and group ID.

among its startup messages. Note that if you enable BindFS mapping while running in "rootless" mode, it will actually cause files on the host to be created with a different owner and group, not root and not the host user. If you see this behavior, do not use BindFS mapping.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions