Mount an NAS-folder via NFS read-write for normal user from console/script


I use a script to mount my shared folders from my NAS-server. The NAS supports samba and NFS. From my Raspberry Pi with Kodi I use MFS and that works super fast. However, from my notebook with Tumbleweed, I mount with CIFS and that is much slower.

I need RW acces from my notebook, and the NAS is password protected. I use a mount command like this:

mount -t cifs -o username=xxxx,password=yyyy,uid=1000,file_mode=0660,dir_mode=0770 //192.168.178.xx/directory /home/user/folder/directory

I could not figure out what the respective mount command for the script would be with username and password for NFS. I tried

sudo mount -t nfs 192.168.178.xx:/directory /home/user/folder/directory

But that mounts read only …

Can someone help me? Thanks!


How do you know?

mount | grep nfs

should show you (and us) how it is mounted.

My assumption is that your user(s) try to write to files (and directories) of which (s)he/they is/are not the owners or have no write permission. But that is normal for every Unix/Linux file where ownership and permissions do not match which the user(s) that want to access.

You can, as root, see who is the owner of the files and what the permissions are there

ls -l /home/user/folder/directory

Ok, here is the output:

bogislav@linux:~> ls -l Shares/
insgesamt 12
drwxr-xr-x  2 bogislav users     6 27. Jan 2018  **Documents**
drwxr-xr-x  2 bogislav users     6 27. Jan 2018  **Movies**
drwxrwxrwx 10 nobody   users 12288 13. Jan 2018  Music
drwxr-xr-x  2 bogislav users     6 27. Jan 2018  **Pictures**
drwxr-xr-x  2 bogislav users     6 27. Jan 2018  **SharedMedia**

bogislav@linux:~> mount | grep nfs
sunrpc on /var/lib/**nfs**/rpc_pipefs type rpc_pipefs (rw,relatime) on /home/bogislav/Shares/Music type **nfs**4 (rw,relatime,vers=4.0,rsize=65536,wsize=65536,namlen=255,hard,proto=tcp,timeo=600,retr

I have no write access. See here for example:

bogislav@linux:~/Shares/Music> mkdir test
mkdir: das Verzeichnis „test“ kann nicht angelegt werden: Das Dateisystem ist nur lesbar

As I said.

The file system is mounted rw (as I highlight above).

The owner of Music is nobody and not bogislav. You should check who is the owner on the server.