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

Read only mounts? #123

Open
ghost opened this issue Jul 4, 2017 · 7 comments
Open

Read only mounts? #123

ghost opened this issue Jul 4, 2017 · 7 comments

Comments

@ghost
Copy link

ghost commented Jul 4, 2017

Is there a way to have bind option make read-only mounts?

@vincenthage
Copy link
Contributor

vincenthage commented Jul 8, 2017

Hi there,
The read-only feature isn't natively included in PRoot,
though there are solutions that might approach what you want:

  • Creating the read-only symlink beforehand, that will act as a read-only filter, and then bind it with PRoot. Though this might require special rights / advanced version of the kernel to do so.
  • You could try @alejandroliu PR that does copy-on-write, but it applies to all files, not only some selected mounts.
  • Way more hard work: add an extension to PRoot, that will create a bind, but also translate each lstat and prevent any file opening on write mode.

@ghost
Copy link
Author

ghost commented Jul 8, 2017

Thanks for answering.
What do you mean by "read-only symlink"? A read-only mount/bind?

@vincenthage
Copy link
Contributor

vincenthage commented Jul 8, 2017

Yep, so with something like this:

sudo mount --bind -r src/ readonly_src/

which links src and readonly_src but only allows read-only operations, from what I've seen.
And then you can create a Proot binding from readonly_src:

proot -r /home/user -b readonly_src/:guest_src/

and guest_src should be a read-only binding.

The issue is that it requires sudo. I don't know if there are user-space solutions for this.

@jopasserat
Copy link
Member

jopasserat commented Jul 8, 2017

A bit convoluted but you might be able to achieve something similar in user land via fuse?

Using something like bindfs for instance

@ghost
Copy link
Author

ghost commented Jul 8, 2017

I guess bindfs is an option. I just have to get comfortable with this thought first, because proot made the user-space bind so easy... :)

@oxr463
Copy link
Collaborator

oxr463 commented Apr 25, 2019

  • Example using bindfs with PRoot for read-only mounts.

@terefang
Copy link

terefang commented Aug 23, 2022

hello, i am new to proot and before i have been creating readonly bind mounts with

mount --bind -o ro ....

is this a way that can be explored?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants