multipass icon indicating copy to clipboard operation
multipass copied to clipboard

Allow specifying wildcards (`*`) for `--[ug]id-map` on mounts

Open dhruvrajan opened this issue 6 years ago • 10 comments

What are the host-side ids to use when running multipass mount? I am accessing files through a user other than "multipass".

Without specifying -u and -g, I see from "multipass info", the following map: "UID map: -2:default". From the code, it looks like both the host and instance ids should be unsigned integers.

dhruvrajan avatar Nov 30 '19 02:11 dhruvrajan

Hi @dhruvrajan,

You're right, it's a missing case at the moment. We default to a mapping of "map all uids/gids to the default user", but we don't support it on the command line.

Saviq avatar Dec 02 '19 13:12 Saviq

Thanks for the quick response! I'm happy to take a look at this and see if I can help.

dhruvrajan avatar Dec 02 '19 23:12 dhruvrajan

@dhruvrajan great! This is where you'd need to look: mount.cpp and then sftp_server.cpp#L302.

Saviq avatar Dec 03 '19 14:12 Saviq

Could this be a bug?

I am running Windows 10 and see the same issue:

Mounts: c:/ => /c-drive
            UID map: -2:default
            GID map: -2:default

It looks like the cause of processes that try to access files in the mount getting 'permission denied' for Read access to files. Here is syslog when I start named with a config file in mount:

Mar 17 14:28:14 mysys named[2300]: loading configuration from '/c-drive/local/named.conf'
Mar 17 14:28:14 mysys named[2300]: open: /c-drive/local/named.conf: permission denied
Mar 17 14:28:14 mysys kernel: [ 2250.379791] audit: type=1400 audit(1584473294.206:27): apparmor="DENIED" operation="open" profile="/usr/sbin/named" name="/c-drive/local/named.conf" pid=2300 comm="isc-worker0000" requested_mask="r" denied_mask="r" fsuid=0 ouid=1000

I have read #1346 (and others covered by 'is:issue is:open map' ), and I don't think they are the issue.

I don't code C or it's variants, but, will be happy to collaborate from a test bed perspective if I can.

hth,

David

dbotham avatar Mar 17 '20 22:03 dbotham

Hi @dhruvrajan,

You're right, it's a missing case at the moment. We default to a mapping of "map all uids/gids to the default user", but we don't support it on the command line.

Isn't that what it's already doing in the command line ? doesn't "-2:default" mean "map all uids/gids to the default user" i tried it and that's what it's doing no ? isn't the "-2" just a special value to indicate (everyone), and "default" is just the default user on the guest ? so it should work for now since there's no way of parsing window's SIDs.

Pastoray avatar May 04 '25 00:05 Pastoray

I'm interesting in solve this issue.

But, I don't know what can be the solution. Map all guest uids/gids with his mirror host uids/gids? @Saviq @Pastoray @dhruvrajan

vicdeveloperr avatar May 21 '25 20:05 vicdeveloperr

I apologize, I was working on this 5 years ago and can't remember the context for this haha. All the best in fixing this.

dhruvrajan avatar May 21 '25 20:05 dhruvrajan

I'm interesting in solve this issue.

But, I don't know what can be the solution. Map all guest uids/gids with his mirror host uids/gids? @Saviq @Pastoray @dhruvrajan

i believe you should inspect where command line arguments are being parsed, which was if i can recall in cli/mount.cpp, of course that's after you run vcpkg instsall and run cmake to actually get most of stuff that's defined in the .proto files, also don't build on windows build on linux or wsl, you might wanna take a look at sftp_server.cpp#L302 as Saviq mentioned.

Pastoray avatar May 21 '25 20:05 Pastoray

I'm interesting in solve this issue. But, I don't know what can be the solution. Map all guest uids/gids with his mirror host uids/gids? @Saviq @Pastoray @dhruvrajan

i believe you should inspect where command line arguments are being parsed, which was if i can recall in cli/mount.cpp, of course that's after you run vcpkg instsall and run cmake to actually get most of stuff that's defined in the .proto files, also don't build on windows build on linux or wsl, you might wanna take a look at sftp_server.cpp#L302 as Saviq mentioned.

Thanks, man. That's helpful.

vicdeveloperr avatar May 22 '25 13:05 vicdeveloperr

I don't understand this issue and if already exists.

@ricab, or @Pastoray you guys understand this? If that the case, explain me how to replicate, please. I really want to collaborate.

vicdeveloperr avatar May 22 '25 15:05 vicdeveloperr