TextEdit refuses to modify a file in /Users/Shared owned by another user despite mode 666
I have a text file in /Users/Shared that I would like to be editable by all users on my Mac. The Get Info window shows that everyone has read and write access, and when I open the file with TextEdit on a non-owner account, the title bar does not state that the file is locked. Yet when I attempt to save my edits, I'm faced with the "The document could not be [saved / autosaved]. You don't have permission" popups.
I've tried adding the non-owner user to the permissions list in the Get Info window. No dice.
Outputs from ls
(with names edited):
$ ls -l /Users/
total 0
drwxr-xr-x+ 14 Guest _guest 476 7 Apr 11:14 Guest
drwxrwxrwt 45 root wheel 1530 12 Apr 17:40 Shared
drwxr-xr-x+ 15 fileowner staff 510 22 Feb 12:49 fileowner
drwxr-xr-x+ 17 admin staff 578 21 Dec 10:55 admin
$ ls -l /Users/Shared/Links.txt
-rw-rw-rw-@ 1 fileowner wheel 619 25 Feb 19:44 /Users/Shared/Links.txt
I can reproduce this behavior on two separate machines, one running 10.8 and the other 10.9, but not on the one running 10.6.
Solution 1:
Notice that the permission string for /Users/Shared ends with a 't'. This indicates that the sticky bit is set for that directory. According to "man 8 sticky",
A directory whose `sticky bit' is set becomes an append-only directory, or, more accurately, a directory in which the deletion of files is restricted. A file in a sticky directory may only be removed or renamed by a user if the user has write permission for the directory and the user is the owner of the file, the owner of the directory, or the super-user.
I suspect that when TextEdit tries to save a file, it first attempts to rename or remove the old file. But in a directory with the sticky bit set, only the owner can do this. Hence, the permission-based failure.
You could test this by trying something like this as user Guest
echo " " >> /Users/Shared/Links.txt
If this is successful, it shows that Guest can write to the file and that TextEdit must be renaming or removing, not just rewriting the file.