I want to use rclone-mount on Android to mount remote directories from my own server as well as from pCloud. I want the mount points to be established automatically at boot time and to remain mounted full time.

I have not been able to install Magisk on this device yet. See How to install Magisk without an unlocked bootloader?

I tried the following rclone-mount method with Termux:

How to mount rclone on Android?

Unfortunately, that results in permissions errors that I have not been able to solve. I posted a question about it here:

scripts - How to use rclone-mount with Termux:Boot?

That remains unresolved. I have worked on this for many hours, so I could add more info to my other question if needed. However, with the assistance of @alecxs I tried another approach and resolved the permission errors. Now rclone can now successfully mount both pcloud and my own server when I run the commands at the CLI.

My current question is, how to automate this without Termux:Boot or Magisk? II can't install Magisk and Termux gave me tons of trouble for a couple weeks and I only got this working by ditching Termux. Again, see the above question if you think you know the reason for the Termux problems.)

For background, and to possibly help others, I am listing all my steps so far since the commands are working and this might prove to be a useful supplement for Irfan Latif's great answer that helped me get started with rclone-mount on Android.

  • removed Termux (& verified all files are gone)
  • removed Magisk app (the module was never installed)
  • kept original SuperSU v2.82 (& verified it doesn't have trackers)
  • gave network access permissions to apps running under root in AFWall+
  • used "Simple SSHD" app (from F-Droid) to access device via SSH (from my PC)
  • I have a working rclone.conf file already
  • my env var LD_LIBRARY_PATH is empty and I did not have to modify it with this method
  • my device is Arm64
  • echo $PATH = /sbin:/system/sbin:/system/bin:/system/xbin and I put the binaries into /system/bin EDIT: @alecxs pointed out that these custom binaries should have been installed to /system/xbin.

First, I put the binaries into the correct directories on my Android device:

cd /path/to/files/gocryptfs_fusermount-ARMHF_2021-01-13/

NOTE: the fusermount binary comes from XDA / mirfatif: https://forum.xda-developers.com/m/mirfatif.7805402/ Fusermount on android (rclone mount) XDA Forums

$ scp -P 2222 fusermount

On Android, become superuser:


install fusermount binary:

mount -o rw,remount /system
mv /system/bin/fusermount /system/bin/fusermount.termux
cp ./fusermount /system/bin/fusermount
chmod 775 /system/bin/rclone
chown system:shell /system/bin/fusermount

check SELinux context and DAC permissions:

# ls -laZ /system/bin/fusermount
-rwxrwxr-x 1 system shell u:object_r:system_file:s0 114056 2021-10-25 01:29 /system/bin/fusermount

Install the official rclone binary: NOTE: The rclone binary I'm using is from: https://beta.rclone.org/test/testbuilds-latest/rclone-android-21-armv8a.gz

I have it on my phone at: /storage/emulated/0/Documents/rclone-android-21-armv8a

mount -o rw,remount /system
ls -la /system/bin/rclone
lrwxrwxrwx 1 system shell 42 2021-10-21 19:55 /system/bin/rclone -> /data/data/com.termux/files/usr/bin/rclone
rm /system/bin/rclone
cp /storage/emulated/0/Documents/rclone-android-21-armv8a /system/bin/rclone
chmod 775 /system/bin/rclone
chown system:shell /system/bin/rclone

# ls -laZ /system/bin/rclone
-rwxrwxr-x 1 system shell u:object_r:system_file:s0 62257128 2021-10-26 19:45 /system/bin/rclone

Optional (if needed, restore SELinux context -- I did not need to do this):

restorecon -F /system/bin/rclone
restorecon -F /system/bin/fusermount

Finished, so mount readonly again:

mount -o ro,remount /system

Check the mount namespace:

# readlink /proc/1/ns/mnt
# readlink /proc/self/ns/mnt

If they don't match, run the command below. (Mine match)

nsenter -t 1 -m -- "$0"

Verify the remote is not already mounted:

# ls -la /mnt/runtime/write/emulated/0/mypcloud/

Set env var for rclone config:

export RCLONE_CONFIG=/data/data/org.galexander.sshd/files/rclone.conf

Now manually mount remote using rclone:

rclone -vvv mount mypcloud: /mnt/runtime/write/emulated/0/mypcloud --gid 9997 --dir-perms 0771 --file-perms 0660 --umask=0 --allow-other --cache-dir /storage/emulated/0/.cache --vfs-cache-mode full --vfs-cache-max-age 2h0m0s --vfs-cache-poll-interval 5m0s


to umount:

fusermount -u /mnt/runtime/write/emulated/0/mypcloud

There is really nothing new in the steps above that Irfan Latif didn't already discuss. However, there are differences. For example, I did not need to set LD_LIBRARY_PATH. Also, rclone emits this warning:

WARNING: linker: /system/bin/rclone: unsupported flags DT_FLAGS_1=0x8000001

However, that doesn't appear to be a problem. I also show more info about SELinux contexts and a few other things. There are enough differences from the existing answer that my steps might help someone else with their own troubleshooting.

Now, my main question how can I automate this at boot time without Termux:Boot or Magisk? I guess I could put a script into init somewhere, but I would appreciate an expert answer. I have reviewed a lot of answers about init.rc and executing scripts at boot. They have mostly sent me to solutions that were obsolete by Android 4.x and they also do not deal with the question of how to handle the case of booting up when a network connection is not available.

EDIT: @alecxs contributed the following idea for booting up when a network connection is not available:

until dumpsys connectivity | grep -iq state..connected
    sleep 1
done && rclone <...> & 

My device is running Android 7.0 (US Samsung Galaxy S8). It is rooted, I have true root, it has SuperSu 2.82, SELinux is permissive, and I can remount /system rw (as shown above). I do have the /system/su.d/ directory.

Also, related question, where is a good / safe location (path) on my Android device to keep my pcloud token and my private ssh key (for the remote SFTP server)?

  • 1
    worth mention your device is bootloader locked therefore impossible to modify init.rc
    – alecxs
    Oct 27, 2021 at 10:44
  • 1
    @alecxs why to modify /init.rc? You can put a new anything.rc file in /system/etc/init/ when you have write access to /system. Oct 27, 2021 at 18:31
  • @IrfanLatif ah.. thought etc/ in boot.img is the only location
    – alecxs
    Oct 27, 2021 at 18:33
  • 1
    @alecxs /etc symlink has always been pointing to /system/etc. Oct 27, 2021 at 18:36

2 Answers 2


@MountainX, first of all, thank you so much for this post! It really helped me setting up rclone mount on my phone. To automatically start rclone mount at bootup, I'm using Tasker. It has "Device Boot" event, which can run a task. In that task I'm using "run shell" with root privileges and here is the command I use:

nsenter -t 1 -m -- rclone mount OneDrive: /mnt/user/0/emulated/0/OneDrive --daemon --config=/sdcard/rclone.conf --gid 9997 --dir-perms 0771 --file-perms 0660 --umask=0 --allow-other --cache-dir /storage/emulated/0/.cache --vfs-cache-mode full --vfs-cache-max-age 2h0m0s --vfs-cache-poll-interval 5m0s

Create a file named rclone_mount.sh (or any name you choose). My PC is running Linux, so I don't have to worry about line endings.

Add these commands to it:


export RCLONE_CONFIG=/data/data/org.galexander.sshd/files/rclone.conf;

rclone mount mypcloud: /mnt/runtime/write/emulated/0/mypcloud --gid 9997 --dir-perms 0771 --file-perms 0660 --umask=0 --allow-other --cache-dir /storage/emulated/0/.cache --vfs-cache-mode full --vfs-cache-max-age 48h0m0s --vfs-cache-poll-interval 2m0s

Set your rclone options in the above command as desired.

Send the file from PC to Android device. I use scp like this:

scp -P 2222 rclone_mount.sh

On my Android device, install the file:

mount -o rw,remount /system
cp /data/data/org.galexander.sshd/files/rclone_mount.sh /system/su.d/
chmod 700 /system/su.d/rclone_mount.sh
chown root:root /system/su.d/rclone_mount.sh
mount -o ro,remount /system

The hardest part of this is probably finding a location for the script where it will get executed automatically when the phone boots. Since I have SuperSU, the choice was easier: /system/su.d/.

For all the reasons indicated in the OP, my script was simpler than might have been expected. Since it runs on boot, there is no need to check/unmount the remotes. I don't need to set LD_LIBRARY_PATH. I don't need to become su (as it is run by SuperSU), etc. It's a very simple script.

Caveat: I only tested it once so far. I'm open to suggestions and I will be using it extensively over the coming days/weeks, so I may find issues that need to be fixed.

  • 1
    It's great that the solution worked for you. But I'd say it's an incomplete solution. /system is not a partition mountpoint on SAR devices. Mounting /system RW breaks dm-verity. su.d isn't a standard directory. If rclone gets unmounted, you'll have to restart the device to re-mount it. // More explanatory answers: How to run an executable on boot and keep it running? and How can I run a script on boot? Oct 27, 2021 at 18:29
  • @IrfanLatif - thanks for your feedback. Yes, it is definitely incomplete and rough. I want to improve it. Much of what is in the answers you linked pertains to Magisk, which I don't have. But I will read them again to see what else I can do without Magisk, and I welcome any specific suggestions from you.
    – MountainX
    Oct 27, 2021 at 22:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .