1

I have some file image of filesystem, and I want mount it with parameter changing files and directories UID and GID. I cannot change its parameters, because it is read-only filesystem.

I found some idea, using some overlayfs and by find command walk through all files on mount points and rewrite attributes. But it needs some additional filesystem. I don't want use this method. I don't need write anything to this filesystem.

Then is there some idea to change UID/GID on the fly by mount options? Is there some cover like filesystem to use on this situation?

  • you're right. I didn't found those question. – Znik Dec 26 '19 at 15:37
1

Then is there some idea to change UID/GID on the fly by mount options?

Yes. Many file systems support uid=NNNN and gid=NNNN options at mount time. It depends on the file system whether that subsequently applies to all files and directories within the image.

mount -t fstype -o loop,uid=1234,gid=1234 /source/file.img /destination/point
| improve this answer | |
  • of course. some filesystems supports uid,gid mount attributes. some accepts setuid,setgid. unfortunately not all. but bindfs pointed as duplication of my question, resolves my problem. – Znik Dec 26 '19 at 15:39

Not the answer you're looking for? Browse other questions tagged or ask your own question.