I am syncing files to my phone (Fairphone 4) with Nextcloud, and wish to access these files using termux. Currently access is denied, is there a way to set this up to work other than rooting the device or is that the way forward?
Unfortunately Termux cannot pass SAF-based storage access (like you would do with a file explorer by selecting - for example - a file using Google Drive app).
But there is an alternative : Rclone. Rclone can give you access to many and many online drives (including NextCloud). It is only a command-line utility.
To install it in Termux, simply run
pkg in rclone.
Then, you need to set the remotes (= online drives) you want :
rclone config. See the docs to know how to add remotes correctly.
Say you now have a remote with the name "myRemote", you can do whatever you want :
- Copy a file to current local directory in Termux :
rclone copy myRemote:file2Copy.txt .
- List the files on the remote :
rclone ls myRemote:
The only drawback, is that you can only access to rclone remotes using a terminal.
There is a way to mount rclone remotes on the device, but you need to be rooted. Check this great answer here if you are interested.