On a CentOS7 system I installed samba to create a share for windows clients using the following steps:

mkdir /samba/myShare

Then I definded /samba/myShare as my shared folder via the smb.conf file. After that, I did the following steps:

chmod 777 /samba/myShare #(drwxrwxrwx)
mkdir /samba/myShare/myFolder
chmod 774 /samba/myShare/myFolder #(drwxrwxr--)

Now I thought that the myFolder directory would be protected against changing its name or deleting it via Windows users by giving just read-permission to "other users" but that was not the case. The directory itself remained writeable. Then I was googling for it and came to the point that the directory remained writable because as a child-directory it takes the permissions from his mother-directory, which is /samba/myShare in my case. But now comes the strange thing that confuses me a lot:

  • When I do a chmod 773 /samba/myShare/myFolder (drwxrwx-wx) I am not able to change or delete the directory itself via Windows anymore. Could someone please explain what this is all about?
  • Why can I delete and change myfolder via the Windows client when I set the permissions to drwxrwxr-- and cannot delete or change it when I set the permissions to drwxrwx-wx?

The entry in the smb.conf may be helpful:

workgroup = SAMBA
security = user
passdb backend = tdbsam
printing = cups
printcap name = cups
load printers = yes
cups options = raw
map to guest = bad user`
comment = myShare
path = /samba/myShare
public = yes
writeable = yes

Oh yeah: I know that setting 777-permissions is not very common but this was just for testing.


In Unix erasing or renaming a file/directory is an action on its parent directory. The access flags apply to the inode pointed to by the name.

  • Sounds clear to me but still the fact that setting permissions to (drwxrwxr--) lets me erase and renaming the folder but (drwxrwx-wx) does not, is confusing me. If it's true what you wrote then this change should take no effect on this because I didn't change anything in the parent directory. Correct me if I'm wrong. – Tecbill Jun 27 '17 at 8:40
  • If the directory isn't readable commands that should erase it cannot access the inodes of its files/subdirectries and therefore cannot empty it. So if the directory is not empty you cannot erase it on Linux, even with rm -rf (you can still rename it). If it's empty then it is erasable. – xenoid Jun 27 '17 at 9:06
  • Really good remark that point with the empty folder, I didn't know that, thanks a lot!!! – Tecbill Jun 27 '17 at 14:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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