Why this happens
Windows will not read the desktop.ini
unless it's a system file (seemingly readonly also works, but system file means it can stay hidden even when you set non-system hidden files to visible).
Why you seemingly can't fix it
On a Samba share (Unix implementation of SMB/network share protocol), sometimes even if you e.g., go to properties and set "read only", it will be ignored and not set. This is because Samba isn't by default storing these permissions - which seems to carry a (probably negligible) performance tax, as permissions are (AFAIK) set and read in alternate streams as textual data (probably wouldn't work if you're sharing some rudimentary FS such as FAT).
How to fix it
First make sure Samba stores DOS-style permissions (like "system"), by adding this line on your share definition:
store dos attributes = yes
Maybe you can add this to [Global]
, I've added it to a specific share instead.
Also, some people will tell you to edit the wrong file.
/usr/share/samba/smb.conf
<= nonsense
/etc/samba/smb.conf
<= right file
Restart Samba (sudo service samba restart
), then make a quick check to see if you can use Windows Explorer to make a file read only for example, and if it persists.
Ok, now, you can make the desktop.ini
a system/hidden file. To do this, go to the folder where it is with command prompt, and use:
attrib +s +h desktop.ini
Optionally also (if your icon is relative and stored in the same folder as mine is).
attrib +s +h folder.ico
Lastly, you need to mark the folder itself as read-only (makes no sense and sounds stupid, so you know it's legit).
attrib +r .
Of cours, you can (should) script this. Using MSysGit's bash, I did this on my whole NAS:
find . -type f -iname desktop.ini | while read -r i; do
echo "Processing \"$(basename "${i%/*}")\""
attrib +s +h "$i"
attrib +s +h "${i%/*}/folder.ico" # Optional, in case you have these.
attrib +r "${i%/*}"
done
Possible duplicate of Set custom folder icon for a network folder in Windows File Explorer
– matt wilkie – 2016-10-17T21:35:11.717@mattwilkie: possibly, although this predates that by 3 years – Eric – 2016-10-17T22:12:28.080
1Acknowledged @eric, the other has better answers though. Either way as long as they're linked things are improved. – matt wilkie – 2016-10-17T22:21:54.417