Locked files are deleted when trash is emptied!

I have no idea why this is happening.


Usually when I have locked files in the trash, if I empty trash, it says that it can't because the files are locked.

Now it just deletes everything in the trash, locked files included!


I created a bunch of new files, locked them all, then emptied the trash. They are all gone!


What is going on?

MacBook Pro 13”, macOS 10.14

Posted on Mar 14, 2019 6:36 PM

Reply
5 replies

Mar 14, 2019 8:31 PM in response to Frank Yaker

Yes, it used to be that we had to use the "Option" key, but alas, apparently no more.


You know, one thing that just occurred to me -- and I don't know this for a fact -- is that maybe the reason why it works this way is because we have Admin status on our machines, so the system knows that we are to be trusted with our decisions, even though we will still be required to enter an Admin password when we want to alter the system through an app installation, for example. The system is designed to always protect itself, particularly under SIP.


So I am wondering what would happen if a non-Admin were to log into a machine. Would they experience the same thing as us? Or would they be further challenged and told that they cannot trash or permanently delete a locked file?


Here is something else to consider: The files I just tested were created by me. That obviously means that I am the owner of them, and have the read & write permissions for them. That too could possibly be what this is all about.


Anyway, I hope you find this helpful. Thanks! :)


Mar 14, 2019 8:21 PM in response to WordWeaver777

Hi and thanks for the response!


Everything that you describe is exactly what happens to me.

It gives me the dialog warning about moving it to the trash too.


So after you agree to move it to the trash, and then click "empty", it does just delete the file?

It doesn't say that you can't because the file is locked?


I've always had to hold down option while clicking "empty" when a locked file was in the trash for it to be deleted.

Mar 14, 2019 8:44 PM in response to WordWeaver777

I just checked another machine of mine that is running 10.11.6. When I try to empty the trash with the locked file it says,

"There are some locked items in the trash. Do you want to remove all the items, including the locked ones, or just the unlocked items?"

This is what I was expecting and I don't see it anymore. The thing is, I'm almost certain that this newer computer was doing it up until today.


I'm wondering, is there some kind of command in the terminal that would make this feature stop?


Or can some other people confirm too, that Mojave does not do this anymore?


Mar 14, 2019 7:50 PM in response to Frank Yaker

Frank, I just decided to experiment myself.


I created a copy of a text file and then locked it.


Whether I select "Move to Trash" under the contextual menu, or use command-delete, or manually drag the file to the Trash, it presents me with the dialog "Item "so-and-so" is locked. Do you want to move it to the Trash anyway?"


If I answer in the affirmative, it then asks me if I want to permanently delete the file.


Is this the kind of behavior that you are experiencing?


BTW, what do your Finder preferences look like on the "Advanced" tab? Like this?:



Mar 14, 2019 9:00 PM in response to Frank Yaker

Yes, I also have an El Capitan machine, in addition to the Mojave one that I am currently on, and behaves the exact same way as you have just described. So, it seems to me that this is now the new default behavior.


As far as Terminal commands go, yes, there are ways to change the permissions on the invisible trash can under your user account.


If you want to experiment, you can try to do the following. It will delete your current trash can -- under your user account -- and force the system to create a new one when you reboot, and it will have the default ownership permissions. You can then experiment like before and determine if you get the same behavior. If so, then I would say again that that is just the way things are now.


As far as what permissions to use in order to get back the behavior that you desire, I am not sure, assuming that it is even possible at all.


1. In the Terminal, type the following:


sudo rm -ri ~/.Trash


2. Enter your Admin password when prompted.


3. When you see the prompt "examine files in directory /Users/armageddonx/.Trash?" . . .


Answer "yes". [without the quotes, obviously]


4. When you see the prompt "remove /Users/armageddonx/.Trash/.DS_Store?" . . .


Answer "yes". [without the quotes, obviously]


5. When you see the prompt "remove /Users/armageddonx/.Trash?" . . .


Answer "yes". [without the quotes, obviously]


6. If there are any other trash prompts regarding files or folders in the trash, answer according to what you want to do with them.


7. Log out of your Admin account, and then log back in again.


8. A new ".trash" folder should now be created with the default permissions.


If this info has been helpful, and/or has resolved your issue, please let me know. Thanks!


This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Locked files are deleted when trash is emptied!

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