I am trying to mount an NFS share on my Android phone.
I have already compiled and installed all the needed kernel modules. The NFS share mounts flawlessly but I can only mount as the system
user.
This wouldn't be an issue if I could set the correct ownership for the mounted file system.
The problem is that the share is always mounted as user=system
and group=system
, making it inaccessible to regular apps.
I would like to be able to specify the ownership of the mounted filesystem at mount time.
This is how I mount the NFS share
su -c "busybox mount -o nosuid,nolock,nodev,rw,nofail,noatime,intr,tcp,actimeo=1800,context=u:object_r:rootfs:s0,user -t nfs $REMOTE_URI $LOCAL_DIRECTORY"
where REMOTE_URI is the remote location and LOCAL_DIRECTORY is the local directory. The above command is inside a script.
This is the relevant line of the /etc/exports
file on the NFS server (a raspberry pi 3)
/media/neo/BLACKBOX XXX.XXX.XXX.XXX/0(rw,insecure,sync,no_root_squash,no_subtree_check,anonuid=1000,anongid=1000)
System Specs:
- LG V20 H990DS
- System - V10i-TWN (6th-Nov-17) 7.0 Stock, Rooted & Xposed
- Kernel - D.O.T.S. v1.4
- NFS version 4
PS: The UID and GID on the server are 1000 and 1000 respectively. In Android those are reserved for the system user and group. All my other computers have UID and GID 1000 and the same username neo
. It would be much easier to just modify how Android mount the share. I would like to map uid=neo(1000)->root(0)
and guid=neo(1000)->sdcard_r(1028)
where neo:neo
is the user on the server and root:sdcard_r
is the user on the phone.