Skip to content

Instantly share code, notes, and snippets.

@emendir
Last active May 27, 2025 19:15
Show Gist options
  • Save emendir/3b69c717dc431d23223de0cc3b312723 to your computer and use it in GitHub Desktop.
Save emendir/3b69c717dc431d23223de0cc3b312723 to your computer and use it in GitHub Desktop.
Ubuntu Touch Access Waydroid Files

Ubuntu Touch: Access Waydroid Files from Host System

This script sets up a systemd service on Ubuntu Touch to grant the phablet user access to key directories of the Android system inside the Waydroid container (such as Download and Documents). This is enables you want to manage Waydroid's user files directly from the Ubuntu Touch file manager or terminal, and share files between the two systems.

What it Does:

  • Adjusts folder permissions to make Waydroid’s shared storage readable/writable by the host.
  • Creates a systemd service that waits for Waydroid to start, then applies the required permissions automatically.
  • Creates a convenient symbolic link (~/Waydroid) in the phablet user's home directory for quick access.

Affected Directories:

  • ~/.local/share/waydroid/data/media/0/

    • Download/
    • Music/
    • Documents/
    • DCIM/

To add more folders, update the chmod commands in the CHMOD_CMD variable in the script below

🛠 Installation:

  • On Ubuntu-Touch, in the terminal app, run the below shell script as the phablet user (or appropriate user with sudo access).
  • To allow your phablet user to write to the Android filesystem, you'll need to add the phablet user to the group that owns the Waydroid folder's contents, in my case this is group ID 1023:
sudo groupadd -g 1023 waydroid
sudo usermod -a -G waydroid phablet

📎 Notes:

  • This assumes a standard installation path (/home/phablet/.local/share/waydroid).
  • Check that you're comfortable with the permissions applied using the chmod command
  • When opening the file-manager in Ubuntu-Touch, one must press the Unlock button in the Restricted access banner and authenticate to view the Waydroid symlink

## Waydroid Home-Folder Permission

# command to modify permissions to allow phablet user to read and write
# to Waydroid home folder subfolders
CHMOD_CMD="chmod ugo+rx /home/phablet/.local/share/waydroid/data/media/0/Documents/ && chmod ugo+rx /home/phablet/.local/share/waydroid/data/media/0/DCIM/ && chmod ugo+rx /home/phablet/.local/share/waydroid/data/media/0/Music/ && chmod ugo+rwx /home/phablet/.local/share/waydroid/data/media/0/Download/   && chmod ugo+rx /home/phablet/.local/share/waydroid/data/media/0/ && chmod ugo+rx /home/phablet/.local/share/waydroid/data/media/&& chmod ugo+rx /home/phablet/.local/share/waydroid/data/"

# create systemd service which applies permissions whenever Waydroid starts
echo $"[Unit]
Description=Give phablet user read-write permissions to waydroid's home folder.
After=waydroid-container

[Service]
ExecStart=/bin/bash -c 'while [ -z \"\$(waydroid status | grep RUNNING)\" ]; do sleep 1; done; sleep 20; $CHMOD_CMD'

[Install]
WantedBy=multi-user.target
" | sudo tee /etc/systemd/system/waydroid-permissions.service
sudo systemctl daemon-reload
sudo systemctl enable --now waydroid-permissions

# create symlink in Phablet's home folder pointing to the Waydroid home folder 
ln -s /home/phablet/.local/share/waydroid/data/media/0/ ~/Waydroid
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment