Secure way of sharing host files and directories with Waydroid #1107
Replies: 5 comments 1 reply
-
|
I've managed to mount the directory using
|
Beta Was this translation helpful? Give feedback.
-
|
Also, as far as I noticed, the |
Beta Was this translation helpful? Give feedback.
-
|
On the host side, I use this script: |
Beta Was this translation helpful? Give feedback.
-
|
The AppArmor profile mentioned is this: Please note that you may have to replace |
Beta Was this translation helpful? Give feedback.
-
|
Hi! I apologize for bumping this, but do you have a guide or step-by-step on how to do this? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello everyone! I'd like to discuss the topic of sharing files with Waydroid. Documentation on the official site recommends bind-mounting the into
~/.local/share/waydroid/media/0/..., however, that may cause issues on Android 11 due to MediaProvider FUSE mount on the shared storage.I propose a better, more secure way by installing a document provider, for example, Termux or RCX, and bind-mount into their directory. For Rcx, however, you need to enable Document Provider functions in the settings:

Then, add the "Local" storage to the list:

The files have to be bind-mounted to the
/storage/emulated/0/Android/data/io.github.x0b.rcx/filessubdirectory (on the container) or~/.local/share/waydroid/0/data/media/0/Android/data/io.github.x0b.rcx/filessubdirectory (on the host side). I should also note that, for better security, you should make sure that only the document provider (Rcx in our case) has access to the directory. You can use bindfs for this. First, you need to determine the UID the document provider runs as by running thepm list packages -Uas root in the container (for example, by usingwaydroid shellsubcommand), and then, on the host side, run a command like this (for Rcx):bindfs --mirror-only=$UID $host_dir /home/$user/.local/share/waydroid/data/media/0/Android/data/io.github.x0b.rcx/files/from_host/where
$UIDis the UID Rcx runs as,$host_diris the directory to be bind-mounted, and$useris the name of the user on the host that runs Waydroid. By doing this, we ensure that only Rcx (and root) has access to the bind-mounted directory, so files can only be accessed using Storage Access Framework (that has to be approved by user for each app).Beta Was this translation helpful? Give feedback.
All reactions