0

Firstly, I'll show you here my drive status, because I don't want to take just "don't use 777" answer.

Filesystem      1K-blocks     Used  Available Use% Mounted on
udev              3961312        0    3961312   0% /dev
tmpfs              798580     8916     789664   2% /run
/dev/sda2       122030736  4687540  111101356   5% /
tmpfs             3992888        0    3992888   0% /dev/shm
tmpfs                5120        0       5120   0% /run/lock
tmpfs             3992888        0    3992888   0% /sys/fs/cgroup
/dev/mmcblk0p1   15371584     6184   15365400   1% /boot/efi
/dev/sdb1      9688349816 18398760 9181614572   1% /NAS
/dev/sdc1      9688349816    81276 9199932056   1% /NAS2

as you can see, all of the best important are in sda1(wrote to tmpfs) and less but still important are in sda2

and now, I want to change my sdb1 and sdc1 's permission to 775 or 777, permanently.

I successfully link these two NAS folder to my windows main PC, and I grab all of my garbage to /NAS/ and boom, permission denied occurred.

of course I made my /NAS/ to sudo chmod 777 /NAS/ but it just worked alone to make /NAS/folder_level_1/, if task made more folder in lv1, then lv2 or another lv1 folders has no permission.

so I re-change sudo chmod every time my windows pc made new folders in /NAS

I read Grant permission for new created files inside folder automatically, and tried it.

efirlus@Efirlus-NAS:~$ dpkg -s acl
Package: acl
Status: install ok installed
Priority: optional

efirlus@Efirlus-NAS:~$ getfacl /NAS/samba/
getfacl: Removing leading '/' from absolute path names
# file: NAS/samba/
# owner: nobody
# group: nogroup
user::rwx
user:nobody:rwx
group::rwx
group:nogroup:rwx
mask::rwx
other::rwx
default:user::rwx
default:user:nobody:rwx
default:group::---
default:group:nogroup:rwx
default:mask::rwx
default:other::---

efirlus@Efirlus-NAS:~$ setfacl -m "o:rwx" /NAS/samba/

and it didn't work.

P.s I set up my nas followed to https://www.fosslinux.com/8703/how-to-setup-samba-file-sharing-server-on-ubuntu.htm


Rinzwind gave me a post exactly same problem as me. Thanks very much, but unfortunately it wasn't worked.

I followed his guide Grant permission for new created files inside folder automatically like

efirlus@Efirlus-NAS:~$ sudo setfacl -d -m u::rwx,g::rwx,o::rwx /NAS/samba
efirlus@Efirlus-NAS:~$ sudo getfacl /NAS/samba/
getfacl: Removing leading '/' from absolute path names
# file: NAS/samba/
# owner: root
# group: root
user::rwx
group::r-x
other::rwx
default:user::rwx
default:group::rwx
default:other::rwx

as you can see, there are default options, exactly 777

however when i drag my folders to z drive(it mounted in windows), permission error occurred.


I found this post in google https://unix.stackexchange.com/questions/98007/how-do-i-set-permissions-recursively-on-a-dir-with-acl-enabled

it worked!

Now I accept Rinzwind's advice, I'll set my acl to rwx, r-x, r--

  • 1
    You hear hundreds and thousands of people on the web say " do not use chmod 777" and you came to the conclusion to "oh let's do chmod 777". Really?! Please either take security SERIOUS and change the OWNER and GROUP like you are supposed to do or go back to windows. The maximum permissions on a NAS for personal use is "chmod 750" for directories and "chmod 640" for files. And yes, files need to be treated differently to directories if the NAS has a posix compliant filesystem. Otherwise you need to set permission when mounting. – Rinzwind Feb 24 '20 at 10:46
  • 3
    Does this answer your question? [How to allow Windows pc to modify Linux files over Samba server without allowing full 777 access?](https://askubuntu.com/questions/914604/how-to-allow-windows-pc-to-modify-linux-files-over-samba-server-without-allowing) – Rinzwind Feb 24 '20 at 10:57
  • You don't need acl. The chmod manpage has the (insecure) answer. – user535733 Feb 24 '20 at 13:40
  • @Rinzwind Thank you for worry, and important post link. I followed that guide, but it wasn't worked. very sad. – E.Laemas Kim Feb 25 '20 at 01:11

0 Answers0