1

16.04 attempting to rsync with a LAN connected Western Digital Mycloud NAS. CIFS utilities installed to 16.04:

sudo apt install cifs-utils

Mounted remote NAS to /mnt/nas :

mount -t cifs //192.168.8.XXX/Public -o username=root,password=secret /mnt/NAS

Successfully listed (read) the contents of /mnt/NAS :

ls /mnt/NAS/Azimuth_Backup/

SYMPTOM: unable to write to the NAS from 16.04:

touch /mnt/NAS/text.txt

touch: cannot touch '/mnt/NAS/text.txt': Permission denied

mount details :

 mount | grep -i Public

//192.168.8.XXX/Public on /mnt/NAS type cifs (rw,relatime,vers=1.0,cache=strict,username=root,domain=NAS4TB,uid=0,noforceuid,gid=0,noforcegid,addr=192.168.8.XXX,file_mode=0755,dir_mode=0755,nounix,serverino,mapposix,rsize=61440,wsize=65536,actimeo=1)

If the cifs device is mounted with superuser / root, why am I unable to write to the remote NAS disk? Any examples that solve the issue or sharpen the question are appreciated.

It seems that root is the owner and write permissions are enabled:

ls -l /mnt/NAS | grep -i backup

drwxr-xr-x 2 root root 0 Nov 12 23:19 Backup

  • Are you root when you do the touch command? "file_mode=0755" – jpezz Nov 13 '18 at 16:44
  • @jpezz No: not root. Please consider creating an answer and explanation of how "file_mode=0755" is relevant. While it is nice to overcome the obstacle, I would prefer to understand the why (how the model works). Thank you – gatorback Nov 13 '18 at 16:55
1

Unless you specify otherwise cifs mounts with owner = root and permissions of 755 by default.

You can set dir_mode to 777 which allows everyone on your client system r/w access to your mounted share by adding that to your list of options:

mount -t cifs //192.168.8.XXX/Public -o username=root,password=secret,dir_mode=0777,file_mode=0777 /mnt/NAS

OR you can simply take possession of the mounted share by adding a uid=gatorback ( if that is your client user name ) to your list of options:

mount -t cifs //192.168.8.XXX/Public -o username=root,password=secret,uid=gatorback /mnt/NAS
1

Based on the permissions listed above, only the 16.04 superuser can write to the mounted NAS.

It is directory permissions that need to be set. The first number says that owner can "cd" to the directory, can list files in the directory and can create, delete, modify files in that directory. For group and other users, they lack those last permissions. Your first test should be "sudo touch /mnt/NAS/text.txt" to see if that works. If it does, then you need to set the directory permissions for others to allow them to create/modify/delete files. Read https://www.techrepublic.com/article/linux-file-and-directory-permissions/ for more information on reading, writing, executing files as well as how the directory permissions control access to them.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.