cifs cant delete files even when parent is 777?

Status
Not open for further replies.

dsfew32

Dabbler
Joined
May 9, 2015
Messages
12
From a Freenas CIFS share I have a problem that I can't delete read-only files even if the parent directory is 777. This causes a problem with git: it creates temporary object files that are read only, and even though the parent is 775, it cant remove these temporary files.

user@comp1$ touch d
user@comp1$ chmod -w d
user@comp1$ rm -rf d
rm: cannot remove âdâ: Permission denied
-ALSO-
user@comp1$ git clone <some repo>
....
warning: unable to unlink /media/freenas/files/tmp_pack_Mk8Tdd: Permission denied
....
user@comp1$ rm -rf tmp_pack_Mk8Tdd
rm: cannot remove âtmp_pack_Mk8Tddâ: Permission denied
-ALSO-
user@comp1$ lsattr tmp_pack_Mk8Tdd
lsattr: Operation not supported While reading flags on ./tmp_pack_Mk8Tdd


However, from a local drive or non-freenas cifs share. I can create files, change the permissions to -w, delete these files fine, clone and delete files without these errors.
  • In each case parent directory is set 777
  • In each case file is is set 444
  • If I set +w to the file I can delete it
  • umask: 0002
  • ssh into the freenas box I can delete fine, this seems to be cifs specific
  • user on freenas and client both have the same username and uid/gid
  • Settings:
    • 'Apply Default Permissions' selected
    • Both client/server, same username with uid=1000
    • mount options in fstab (also tried autofs mount from cli): -fstype=cifs,credentials=/root/.smbcredentials,rw,uid=1000,gid=1000,iocharset=utf8,exec\\
  • note the 'â' characters. I have iocharset=utf8,
  • Tried:
    • resetting permissions to 775 via the gui
    • changing mount options
    • in windows and linux clients (with git too)
I understand this is a 'permissions problem', but I'd figure I'd try since I'm at my wits end. I've never had permission errors trying to delete a read-only file when the parent directory is 777
 
D

dlavigne

Guest
Which version of FreeNAS? Why are you using UNIX perms on a CIFS share?
 

dsfew32

Dabbler
Joined
May 9, 2015
Messages
12
Thanks for your help dlavigne.

I am running FreeNAS-9.3-STABLE-201504152200.

So if there is a way to fix this problem without messing with unix perms, I'd be all for that. But my requirements are:

* A freenas share that supports single-user connections from both windows machine and linux machines
* Speed or recommendations aside, I don't want to setup NFS in addition to CIFS given this config, or try and shoehorn NFS in windows
* Don't want to check out git locally when I have a share that is has all these benefits (e.g. backups/snapshots) and the problem is, of course, more than just a git problem anyways

I'm pretty sure all these are supported by stock samba, or minimally, works off of a non-freenas samba share. Messing with unix perms came about when noticing these 'permission denied' errors. But if I should be restricting myself to other commands and the gui instead of chmod/lsattr etc to fix an error like this, I'd be happy to do that. I just can't find any info of what those commands might be. It does look like git for windows works as you would expect (I can delete a file that has been set to read-only with chmod), which makes me suspect it's just something with how I'm mounting the share in linux.



Thanks again.
 

emk2203

Guru
Joined
Nov 11, 2012
Messages
573
If you set the share to windows permissions, FreeNAS uses ACLs to control permissions. You lose nothing and gain a lot more control. Only downside is that you need to deal with setfacl, getfacl etc. to deal with the enhanced rights, which takes some time to get used to.

All your requirements would be fulfilled.
 

dsfew32

Dabbler
Joined
May 9, 2015
Messages
12
Oh cool. I didn't even think about that. I am more used to unix-style permissions, but I think learning set/getfacl might be a better alternative to forcing myself to run git from windows every time, if I can't easily resolve this. Thanks!
 
Status
Not open for further replies.
Top