Sharing data over SMB is one of the most common way, and the other is NFS, NFS approach is pretty simplistic rather than SMB, add some line to config file and re-exports
.
$ sudo apt install nfs-common nfs-kernel-server
/etc/exports
$ sudo nano /etc/exports
# /etc/exports: the access control list for filesystems which may be exported
# to NFS clients. See exports(5).
#
# Example for NFSv2 and NFSv3:
# /srv/homes hostname1(rw,sync,no_subtree_check) hostname2(ro,sync,no_subtree_check)
#
# Example for NFSv4:
# /srv/nfs4 gss/krb5i(rw,sync,fsid=0,crossmnt,no_subtree_check)
# /srv/nfs4/homes gss/krb5i(rw,sync,no_subtree_check)
#
# example 1, this is the simplest form
/media/hgst 192.168.0.0/24(rw,async,no_subtree_check)
# example 2, as NFS by default prevent root intervention, like chown chmod, but sometimes we need it then we can add options to remove root denial, or called by `root squash`
/opt/someapp/someapp-config 192.168.0.0/24(rw,async,no_subtree_check,no_root_squash)
# example 3, deny all user, except `UID 1000`, in this case we must ensure that all the directory and file writeable and readable by `UID 1000`
/opt/someapp/someapp-config 192.168.0.0/24(rw,async,no_subtree_check,all_squash,anonuid=1000,anongid=1000)
$ sudo systemctl restart nfs-server.service
$ sudo apt install nfs-common
/etc/fstab
192.168.0.2:/opt/someapp/someapp-config /media/nfs nfs4 defaults 0 0
Notice the IP and the path, nfs-host-ip:/shared/path /destination/path
replace to suit your host ip and shared path. Don't forget to create the /destination/path
nfs
$ sudo mount -a;
Then you can access the file on /destination/path
you defined.
sources: