Skip to content
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

How to configure uid/gid with extraMounts option? #71

Closed
onny opened this issue Aug 20, 2023 · 6 comments
Closed

How to configure uid/gid with extraMounts option? #71

onny opened this issue Aug 20, 2023 · 6 comments

Comments

@onny
Copy link

onny commented Aug 20, 2023

Hey,
I'm looking to configure permissions of a 9p mount point. Usually they are owned by root inside the nixos-shell VM. How can I change the ownership?

What I can do currently is:

mount -o remount,uid=<UID>,gid=<GID> <mountpoint>

or alternaivley

bindfs -u 997 -g 997 /var/lib/nextcloud/calendar /var/lib/nextcloud/store-apps/calendar

Best regards
Jonas

@onny
Copy link
Author

onny commented Aug 25, 2023

Hm changing uid and gid doesn't quite seems to work with 9p. Would it be possible to switch to virtiofs?

My current workaround with bindfs:

  systemd.mounts = [
    {
      what = "/var/lib/nextcloud/calendar";
      where = "/var/lib/nextcloud/store-apps/calendar";
      type = "fuse.bindfs";
      options = "uid=997,gid=997";
      wantedBy = [ "multi-user.target" ];
      enable = true;
    }
  ];

@Mic92
Copy link
Owner

Mic92 commented Oct 24, 2023

Have you tried setting these mount options on the virtio-9p mounts?

  dfltuid	attempt to mount as a particular uid

  dfltgid	attempt to mount with a particular gid

Those are coming from here: https://www.kernel.org/doc/Documentation/filesystems/9p.txt

@Mic92
Copy link
Owner

Mic92 commented Oct 24, 2023

There is also X-mount.idmap= otherwise: https://github.com/brauner/mount-idmapped

@onny
Copy link
Author

onny commented Oct 25, 2023

Hm didn't have any luck with these two approaches. Thank you for sharing anyway. Currently I'm trying to use virtiofs but uid and gid mapping as non-root user doesn't seem so simple yet

@Mic92
Copy link
Owner

Mic92 commented Oct 26, 2023

Would be interesting to have support for this in nixos-shell

@Mic92
Copy link
Owner

Mic92 commented Mar 17, 2024

Afaik This is not possible with 9p unfortunately.

@Mic92 Mic92 closed this as completed Mar 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants