Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Help needed to remove “sticky bit” file system lock from a shared folder.

Hi

My wife and I share a Mac, (Ventura 13.6.9) each with our own log in, and we both use a "shared folder" for common files.

After a lot of frustration about file permissions on these shared files, and much searching, I have discovered, that Apple puts a "lock" on shared folders. I quote from the book : Apple Training Series: Mac OS X Support Essentials v10.6: A Guide to Supporting and Troubleshooting Mac OS X v10.6 Snow Leopard :

"The /Users/Shared folder has a unique permission setting that allows all local users to read and write items into the folder yet prevents other users from being able to delete files that they didn’t originally put in this folder. This special permissions configuration is brought to you courtesy of the “sticky bit”. Essentially, enabling the sticky bit on a folder defines it as an append-only destination, or, more accurately, a folder in which only the owner of the item can delete the item.

And the problem with the “sticky bit” file system lock is that the Finder prevents even other administrative users from making changes or even unlocking items they don’t own. In fact, this file system lock extends to the command line as well. Even with sudo access, an administrator is not allowed to change a locked item—with one important exception, the chflags command, which allows an administrator to change file system flags, and among other things allows them to lock or unlock any file or folder on the system."


I would very much like to remove this lock so wife and I both have full read, write, overwrite, save, delete etc access to the shared folder, and never get blocked again by this permission.

The problem is I have zero understanding of how to use the Command Line or Terminal in order to modify it.


I would be very grateful if someone could be kind enough to give me the instructions on how to do this, assuming I am user 'Him' with admin rights and and she is user 'Her'. (I also have 'admin', 'system', 'wheel' and 'everyone' as users, but don't know who they are, except obviously 'everyone'.)


Thanks in advance and Merry Christmas and season's greetings to all.

Guern

iMac 27″ 5K

Posted on Dec 21, 2024 3:54 AM

Reply
20 replies

Dec 21, 2024 11:18 AM in response to VikingOSX

>No need to alter permissions to 777 in the process.


They're already that for the /Users/Shared/ folder; I checked before I posted. Since the person asking said they didn't have any understanding about the command line or Terminal, the details could easily be unnecessarily confusing; this is why I just gave the line to do it in the Script Editor.


(257427)

Dec 28, 2024 2:15 PM in response to Guern2020

You are most likely not going to like this, but in theory it should work.


I am going to give you a command that will apply an Access Control List (ACL) to the /Users/Shared directory and all the enclosed files and subdirectories that should allow anyone in the group "staff" read/write/delete access to everything under /Users/Shared, both old and anything newly created.


By default every user on a Mac is a member of the group "staff" so that would cover you and your Wife as well as anyone else you allow access to your Mac.


Here is the command, followed with step by step instructions:


sudo chmod -R +a "group:staff allow list,add_file,search,add_subdirectory,delete_child,readattr,writeattr,readextattr,writeextattr,readsecurity,file_inherit,directory_inherit" /Users/Shared


Tripple-Click on the above very long command to select all of it.

Command-C to copy the selected text.


Launch Applications -> Utilities -> Terminal

Paste the very long command line into Terminal.

Press the "return" key.


You should be prompted for

Password:

Assuming you are the admin for the Mac, type your macOS account password.

NOTHING will echo back, but the Mac will see every character you type.

When you have finished entering your macOS account password, press the "return" key.


Now check to see if the ACL has been properly applied to the /Users/Shared directory and all the enclosed files and directories.


/bin/ls -leO@ /Users/Shared  # Copy this line, paste it into Terminal, and press return

# example output showing the ACL

drwxrwxrwt@ 50 root  wheel  - 1600 Dec 26 12:03 /Users/Shared
 0: group:staff allow list,add_file,search,add_subdirectory,delete_child,readattr,writeattr,readextattr,writeextattr,readsecurity,file_inherit,directory_inherit

-rw-r--r--+ 1 raharris  staff  -  0 Dec 28 16:47 fred.file
 0: group:staff allow read,write,execute,append,readattr,writeattr,readextattr,writeextattr,readsecurity

drwxr-xr-x+ 3 raharris  staff  - 96 Dec 28 16:47 subdir
 0: group:staff allow list,add_file,search,add_subdirectory,delete_child,readattr,writeattr,readextattr,writeextattr,readsecurity,file_inherit,directory_inherit


I have provided examples of what /Users/Shared should look like, as well as a regular file, and a subdirectory.


If you create new files and subdirectories, they will inherit the ACL giving everyone in group "staff" read/write/delete access.


Good luck.

Dec 28, 2024 6:13 PM in response to Guern2020

@BobHarrris' most recent post by assigning a "staff" ACL to the "Shared" folder does work. I tested it on another test folder within the "/Users" folder where I set the Sticky Bit. I did not want to make any major changes to my regular setup. I also only tested the dual user account access by using the command line to switch users to create & edit files in the modified folder simulating the actual "/Users/Shared" folder.


You will want to copy & paste the command into the Terminal window so that you don't mistype anything since just a single character change will result in failure to change the permissions or set incorrect permissions.


This is definitely the simplest and most effective option since macOS user accounts belonging to the "staff" group will be able to create, edit, and delete any items within the modified "/Users/Shared" folder (by default at least up to Big Sur where I was testing this, macOS user accounts belong to the "staff" group by default). I was about to provide this option, but saw @BobHarris beat me to it. Excellent suggestion @BobHarris.

Dec 28, 2024 6:43 AM in response to Guern2020

Further to my last post (which I may have got slightly wrong, i.e.mixed up between pages and docx files), I can report that, having created various pages and Word.docx files under both my wife's and my own log in, and saved them in the saved folder, we weirdly have divided results:

  • Pages files now seem to work - I can open edit and save files created by my wife in the shared foled, she can open, edit and save mine, and the "get info" for the files is read and write for everybody.
  • Docx documents from Microsoft Word are still misbehaving; ones I create and save are read and write for me but read only for my wife, and vice versa when she creates and saves one. Even worse, she does not even appear in the list of Names with privileges for my docs, and I don't appear in the list of names with privileges for docs created by her.

Also if I copy a file (say PDF) from my own downloads folder and paste it in the "Shared folder", the priviledges in Get Info of the pasted file are : me - read and write, wheel - read only, everyone - read only. When she is logged my wife can see and open the PDF file, but cannot edit it without saving a duplicate copy.


All we want is to be able to open, read, edit and save files in the same "Shared" folder - i.e. to both have full Read & Write access in the Sharing & Permissions section for all files in that "Shared" folder both exisiting files and in the future, without faffing around making duplicates and fiddling with permissions every time.

Dec 21, 2024 6:45 AM in response to Guern2020

It's likely easier to just create a new folder in /Users/Shared and give you both access in the Finder's Get Info window; it won't have the sticky bit set.


If you still want to do it through the command line, choose Utilities from the Finder's Go menu, open the Script Editor, and run:


do shell script "chmod 0777 /Users/Shared" with administrator privileges


(257421)

Dec 21, 2024 7:21 AM in response to Niel

Thank you very much Niel.

If I create a new folder in /Users/Shared and give us both access, and then move all our existing shared files to the new folder, they will keep their access settings, won't they?

Therefore I guess its probably better to go the command line route (not that I'm very comfortable doing so!).


On that, I can copy the shell script into Script Editor, but how do I do that with "administrator privileges", please?

Guern

Dec 21, 2024 8:31 AM in response to Guern2020

I was able to remove the sticky bit using sudo chmod (see below):


Before:

/bin/ls -dleO@ /Users/Shared
drwxrwxrwt@ 49 root  wheel  -      1568 Nov  4 17:48 /Users/Shared


Notice the 't' at the end of drwxrwxrwt, that is the sticky bit turned on.


Removing the sticky bit:

sudo chmod 777 /Users/Shared


After:

/bin/ls -dleO@ /Users/Shared
drwxrwxrwx@ 49 root  wheel  -      1568 Nov  4 17:48 /Users/Shared


Notice that the 't' has changed into an 'x' which is typical for a directory that allows anyone to search it.


FYI: The 49 is just an indication of the number of files and directories plus . and .. that exist in my /Users/Shared. Your value will be different. The 1568 is the size in bytes of my /Users/Shared

/bin/ls -a /Users/Shared | wc -l


PS. I have given my macOS Terminal "Full Disk Access" via System Settings -> Privacy & Security -> Full Disk Access

Dec 21, 2024 10:52 AM in response to BobHarris

One can add a sticky bit to a folder in the following manner. I have a folder on my Desktop initially with the following permission and have changed the directory (cd ~/Desktop) in the Terminal:

drwxr-xr-x@  3 staff       96 Dec 18 04:11 SVG


Now I add and confirm a sticky bit on that folder:

chmod +t SVG
drwxr-xr-t@  3 staff       96 Dec 18 04:11 SVG


I now remove the sticky bit and confirm the change:

chmnod -t SVG
drwxr-xr-x@  3 staff       96 Dec 18 04:11 SVG


No need to alter permissions to 777 in the process.




Dec 22, 2024 4:34 AM in response to Niel

Thanks very much to everyone who is giving of their time and trying to help me.

You are all very high level and have tons of points on this forum, but I am pretty much a rank beginner with scripts and terminal. So apologies for more dumb questions due to lack of understanding! Also I thought I would post all my steps, so others don't repeat my errors!


So far, I have not used sudo chmod as I presume those instructions are for command lines in Terminal and I don’t know what most of those terms mean (e.g. wheel and staff); I don’t even know where to start!

 

Even the Script Editor had me completely fooled for a while. (Don't laugh!) I copied the shell script "chmod 0777 /Users/Shared" into Script Editor, as suggested by Niel, but I didn’t know how to do that with "administrator privileges". (Even though I am an administrator. [i.e. I am set as: Apple menu | System Settings | Users and Groups | ‘my name’ | Allow this user to administer this computer is turned on.])

Then when I opened Script Editor, and inserted the line

chmod 0777 /Users/Shared

and pressed Enter, I got this message, "Syntax error. A number can't go after this identifier", which floored me!


I then re-read Niel's follow up message to “Copy the entire line, including that text” and realization dawned that I was doing it wrong, so I pasted the whole line into Script Editor like this

do shell script "chmod 0777 /Users/Shared" with administrator privileges

and pressed Enter.

Nothing seemed to happen except the text color changed.

It didn’t solve my problem either – when either my wife or I save a document in our Shared directory and try to open each other’s document, we get the message that the document is locked, that we don’t own it, and have to save a duplicate in order to work on it, edit and save it.

Then I realised that I was probably supposed to “run” the script in Script Editor, which I did with the arrow icon in the toolbar.

However, that still hasn’t solved the problem. Opening each other’s files still shows they are locked.


What am I doing wrong, please?

Guern

Dec 24, 2024 11:05 AM in response to Niel

Thank you for your help, Niel.

First, compliments of the season to you!

Second, all users listed in Get info (i.e. me, my wife, system, wheel, everyone), already have Read and Write access.

Nevertheless, having run the script you suggested, I first unlocked the "Sharing and Permissions' and chose me and ran "Apply to enclosed items".

Then I selected "System" and chose "Apply to enclosed items".

I then created a temporary file, (Temp.pages), saved it in the Temp folder, changed to my wife's account, and tried to open it, edit it, and resave it

First time round that worked and I could.

Then I restarted the Mac, and repeated the process. This time when I tried to save the temp file from within my wife's log in, I got the same message as before (the one I am trying to get rid of) that the document is locked, that I (my wide) doesn’t own it, and she must save a duplicate in order to work on it, edit and save it.

In summary, I am still doing something wrong!

I know it is asking a lot, but please could you give me a step by step process of what I need to do?

Guern.

Dec 29, 2024 7:18 AM in response to BobHarris

Thank you very much @BobHarris and HWTech.

I really appreciate the time you have spent on this.  I didn’t understand what every word in all the commands meant, but I had a good idea, and the process was so clearly explained that I had no trouble in executing them.

The results were a very interesting exercise.

I have added all the information below for others to read, but I personally am going to give up – permissions on folders are just too complex, and it will take me forever to learn the code for Terminal. Furthermore, you have done enough already to help, and, lastly, I can’t waste any more time trying to do something which I believe should be dead easy, but isn’t!

So many thanks to all, but let’s close this query.


1.  First of all, I did not get any output for the Shared Directory, like @BobHarris did. i.e. I did not get this:       

drwxrwxrwt@ 50 root wheel  - 1600 Dec 26 12:03 /Users/Shared

 0: group:staff allow list,add_file,search,add_subdirectory,delete_child,readattr,writeattr,readextattr,writeextattr,readsecurity,file_inherit,directory_inherit


Maybe I need to view this from the Documents directory.


2. Second, the permissions for “staff” seemed to have appeared just as @BobHarris said in his post. However, there were also similar permissions for me ( Guern1 ) and my wife( Guern1 ). (see below) . I presume this is because I also have tried (and failed) in the past (through “GetInfo”) to apply Read & Write to all in the Shared directory. 


3.  I discovered there were hidden files in the Shared directory that do not appear in Finder, namely scraps of Microsoft Word documents that somehow got left behind, perhaps if the file was not closed properly.  I’ve seen

them in Windows before, (where ~$ replaces the first two letters of the file name), but didn’t know that they also happened in Word for Apple Mac, but were not being shown.        

The original doument was named Singapore.docx and the line showing the remnant reads as follows

-rw-rw-rw-@   1 root  wheel  hidden   162 16 Sep 21:58 ~$ngapore.docx

    com.apple.quarantine    29

 0: group:staff allow read,write,execute,append,readattr,writeattr,readextattr,writeextattr,readsecurity

 1: user:Guern1 allow read,write,append,readattr,writeattr,readextattr,writeextattr,readsecurity

 2: user:guern2 allow read,write,append,readattr,writeattr,readextattr,writeextattr,readsecurity


4.  A ‘regular’ file which is visible in the Shared directory in Finder had all the same permissions and information for Staff, Guern1 and Guern2 (except not the word ‘hidden” in the first line)but also had all this other stuff as well:

    com.apple.FinderInfo    32

    com.apple.lastuseddate#PS    16

    com.apple.macl      72

    com.apple.metadata:kMDLabel_rssamzs5nzumxih72vtuca5n5i     89

    com.apple.quarantine    29


5.  The sub-directories in the Shared directory (e.g.  Relocatedfiles) show similar permissions to the above.  

However the opening part of the output read  drwxrwxrwx+ (with a + symbol), instead of drwxr-xr-x+ (with

an @ symbol) as per @BobHarris’s example.       I don’t know what the effect of that is.

drwxrwxrwx+   8 root  wheel  -        256 10 Dec  2022 Relocatedfiles

 0: group:staff allow list,add_file,search,add_subdirectory,delete_child,readattr,writeattr,readextattr,writeextattr,readsecurity,file_inherit,directory_inherit

 1: user:Guern1 allow list,add_file,search,add_subdirectory,delete_child,readattr,writeattr,readextattr,writeextattr,readsecurity

 2: user:Guern1 allow

list,add_file,search,add_subdirectory,delete_child,readattr,writeattr,readextattr,writeextattr,readsecurity


continued in next post

Dec 29, 2024 7:15 AM in response to Guern2020

6. The permissions for the files in the subfolders of the Shared directory, when viewed via GetInfo, obviously kept some of their previous permissions when the sudo chmod  Command was run.  For example one file had the following:

Staff:      Read & Write

Guern1:   Read & Write (the file had been saved by me) or     

Staff:      Read only

Everyone:   Read only

Wheel:     Read only

Note it had two rows for staff.

Other files had two rows for my wife, both Read & Write:

The permissions were not consistent, either, some files showed Read & Write for all, e.g. :

Staff: Read & Write

Guern1:   Read & Write

Guern2:  Read & Write

Everyone: Read & Write

Wheel:    Read & Write


My conclusion from this is that there should proabably be a command to strip all existing permissions, before running @BobHarris’s sudo  chmod command:


7. After running @bobHarris’s command, and although I have not tested all the files, the existing files in the Shared Directory all now seem to be “Read and Write”, so both my wife and I can open, edit and save them. Unfortunately, having done all this, when one of us saves a new file in the Shared Directory, the same inconsistency occurs as per my previous post:

·     Pages files now seem to work. I can open my wife's, she can open mine, and the "get info" for the files is read and write for everybody.

·     Docx documents from Microsoft Word, and .xlsx files from Microsoft Excel, however, are still misbehaving; ones I create and save are “Read and write” for me but “Read only” for my wife, and vice versa when she creates and saves one.

  When opened by the other person we get the message that the file is read only and we must save a duplicate if we want to edit it.    [The problem I started this post with.] 

Even worse, she does not even appear in the list of Names with privileges for docs I create, and I don't appear in the list of names with privileges for docs created by her.   

I guess this must be another Mocrosoft quirk where once again its software is sadly not compatible with Apple’s.


8. Last, but perhaps most importantly, both my wife and I are now getting the same new message; that “Time Machine could not complete the backup to my attached back-up disc because the back-up disk has become “Read only” “. At least I think I know how to fix that!


So, thanks again, and cheers!

Dec 30, 2024 12:49 AM in response to Guern2020

Guern2020 wrote:

·     Docx documents from Microsoft Word, and .xlsx files from Microsoft Excel, however, are still misbehaving; ones I create and save are “Read and write” for me but “Read only” for my wife, and vice versa when she creates and saves one.
  When opened by the other person we get the message that the file is read only and we must save a duplicate if we want to edit it.    [The problem I started this post with.]

Maybe Word and Excel -created new temp files produce this glitch?


Does this work if you create a data-only extra APFS volume to the internal disk for sharing? Finder Get Info "Ignore ownership for this volume" should be the default but check that.

Help needed to remove “sticky bit” file system lock from a shared folder.

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.