1

On a samba share, I have a .DS_Store file on a SMB network share that is causing havoc. Even as root, I can not delete or chmod it.

-rwx------  1 bob  acme\Domain Users   6148 Apr 24 09:11 .DS_Store*


sudo chmod 777 .DS_Store 
chmod: Unable to change file mode on .DS_Store: Permission denied

sudo rm -rf .DS_Store 
rm: .DS_Store: Permission denied

sudo mv .DS_Store ../
mv: rename .DS_Store to ../.DS_Store: Permission denied

Strange how the output of ls shows this is an executable (Note the * at the end)

If I look at a similar file on my desktop, it has these permissions.

-rw-r--r--@   1 bob  acme\Domain Users   16388 May 20 15:10 .DS_Store

stat .DS_Store 
771751940 3458764513820547522 -rwx------ 1 bob acme\Domain Users 0 6148 "Apr 24 09:11:42 2015" "Apr 24 09:11:42 2015" "Apr 24 09:11:42 2015" "Apr 24 09:11:42 2015" 16384 32 0x8000 .DS_Store

I can create and delete other files in the same directory as my self (no need for sudo)

The file doesn't have the immutable bit set, so why can't I delete it?

There are other related SO questions, but non of the solutions posted there work for me.

Unable to delete file, even as root
How to create a file even root user can't delete it
https://askubuntu.com/questions/378055/how-to-make-a-file-or-folder-undeletable

Update

Nothing appears to be using the file according to lsof and fsuer. Strangely I could delete the file from a windows computer.

spuder
  • 18,053
  • To unlink a file, you need write permission on its parent directory. chmod-ing the file itself won't change anything. However as root, such restrictions do not apply. – John WH Smith May 20 '15 at 21:31
  • Can you please describe your system configuration more?  Specifically, the machine where the file is actually located (i.e., the Samba server), the clients (from which you access the Samba share), and mount options (i.e., the output from the mount command).  Identify operating systems and versions, and, ideally, Samba versions.  Please do not respond in comments; [edit] your question to add relevant information. – G-Man Says 'Reinstate Monica' May 20 '15 at 22:01

2 Answers2

5

You're using a remote filesystem. If the server doesn't want you to delete a file, you won't be able to delete the file. The local root user is not necessarily all-powerful on the remote machine.

There is presumably an access control list on the Windows machine that causes the file to be read-only or non-deletable through remote accesses.

0

Probably is in use by a process, solution can be easy: umount the share, check for process using file(use fuser,lsof) and if no process is using remove it

elbarna
  • 12,695