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

Can't unlock locked files

Hi,


I can't unlock a locked file on my mac. When I right clock and select "Get Info" the Locked check box is greyed out. At the bottom, I can't change any of the permission settings and the lock icon at the bottom right is greyed out too. I tried from terminal and still have the same issue.



MacBook Pro 13″, macOS 10.15

Posted on Aug 1, 2020 5:12 PM

Reply
Question marked as Best reply

Posted on Aug 1, 2020 9:04 PM

The chflags command should be:

sudo chflags noschg ~/Desktop/hosts\ 2

or

sudo chflags noschg "~/Desktop/hosts 2"


What do you want to do with this hosts file? It won't do anything on your Desktop.

What did you do to edit it?

Did you use anything to change the permissions on it? The superuser immutable flag is not normally set on the hosts file.

14 replies
Question marked as Best reply

Aug 1, 2020 9:04 PM in response to aria114

The chflags command should be:

sudo chflags noschg ~/Desktop/hosts\ 2

or

sudo chflags noschg "~/Desktop/hosts 2"


What do you want to do with this hosts file? It won't do anything on your Desktop.

What did you do to edit it?

Did you use anything to change the permissions on it? The superuser immutable flag is not normally set on the hosts file.

Aug 1, 2020 5:48 PM in response to aria114

How did it get there?


If you run this command in Terminal, it will show the permissions on the files in Desktop folder.

ls -AleO

Those are ells and an Oh, not zeros and ones.


You'll see something like this:

-rw-r--r--@ 1 barney  staff  -   93073 Mar 15 14:54 Brown Dog.svg

Copy the line and paste it into a reply. You can remove your user name. If it isn't your username, then that may be the problem.


Aug 1, 2020 6:03 PM in response to aria114

Well, there you go. The file is owned by root and you don't have permission to write to it.

It also has the superuser immutable flag set so only root can change the file.


How did you get it there?

hosts 2 means nothing and no reason any hosts file would be on your Desktop.


You should be able to delete it using Terminal, but be careful.

Enter this with the space after it, then drag the hosts 2 file into the Terminal window. It will fill out the path to the file.

sudo rm -i 

After making sure it is only going to delete that file, hit return.

sudo will ask for your admin password. Enter it and hit return. It will not echo any characters to the screen when you type.

When it runs, it will ask if you really want to delete that file. Again, make sure it isn't going to delete something else, then type y to confirm delete.

Aug 1, 2020 6:19 PM in response to aria114

Please post the output of:


ls -ale@ “~/Desktop/hosts 2”


Quotes used must be vertical double-quotes, not angled quotes used here in the forum.


Don’t do the following yet, but...


The command to remove the attribute will probably be:


sudo chflags nouchg “~/Desktop/hosts 2”


Again, using vertical double quotes.


Then the following sudo rm file-deletion command should work:


sudo rm -i “/Desktop/hosts 2”


And again, vertical double quotes.

Aug 1, 2020 6:41 PM in response to aria114

Mistakes at the command line and particularly with sudo can be hazardous to your data.


So... How good are your backups? (If that question gives you pause... Go get some backups.)


Look on your keyboard, and find the double quote.


That’s the one you want.


I don’t trust the cut-and-paste to switch to the proper vertical double quote. I’ve had issues with that, too.


And “didn’t work for some reason” tells me rather less than would the error message that was shown.


As for the command tried, did you miss the “Don’t do the following yet, but...”?


Find the double quote character.


Type in the following, using spaces where shown, and using the vertical double quote.


sudo rm -i “~/Desktop/hosts 2”


That should work, here.


Can't unlock locked files

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