Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

jmat46

macrumors newbie
Original poster
Aug 1, 2023
27
1
I made a copy of the hosts file on my desktop and now I get a lock and I can neither modify the permissions nor delete it. I've tried to do it through the terminal (sudo rm -r ; sudo chflags -R nouchg) and I can't... any ideas?
 

gilby101

macrumors 68030
Mar 17, 2010
2,705
1,464
Tasmania
Are you sure you copied it? You might have an alias or symlink?

Try sudo rm -f hosts

What does ls -lae@ show for the file?
 
  • Like
Reactions: jmat46

jmat46

macrumors newbie
Original poster
Aug 1, 2023
27
1
Captura de pantalla 2023-08-12 a las 2.49.04.png
 

jmat46

macrumors newbie
Original poster
Aug 1, 2023
27
1
It's a copy, I tried to change the permissions and it won't let me either.
I have also started a session in safe mode and everything is the same.....
 

bogdanw

macrumors 603
Mar 10, 2009
5,838
2,835
Give Terminal Full Disk Access (System Settings – Privacy & Security - Full Disk Access)
 
  • Like
Reactions: jmat46

jmat46

macrumors newbie
Original poster
Aug 1, 2023
27
1
Captura de pantalla 2023-08-12 a las 15.13.56.png
He intentado todo lo que me ha puesto y no ha hecho nada. También he desactivado csrutil.
Batchchmod it does not make any changes in permissions, and manually it does not let me....
 

jmat46

macrumors newbie
Original poster
Aug 1, 2023
27
1
Captura de pantalla 2023-08-12 a las 15.25.47.png



It won't stop me from opening the padlock to change the permissions
 

bogdanw

macrumors 603
Mar 10, 2009
5,838
2,835
Sorry, I've posted the wrong link

File > Get Info, click the arrow next to General, then deselect Locked

 

jmat46

macrumors newbie
Original poster
Aug 1, 2023
27
1
It won't let me remove the document lock either, It leaves inactive and does not let you select it.
This MacBook Air has overwhelmed me….🥵🤬
 

bogdanw

macrumors 603
Mar 10, 2009
5,838
2,835
You could just ignore or hide it :)
Or, very carefully, delete it from Terminal in Recovery
https://support.apple.com/guide/mac-help/mchl82829c17/13.0/mac/13.0
First use ls to confirm you have written the path correctly
Code:
ls "/Volumes/Macintosh HD – Data/Users/YourUserName/Desktop/hosts"
then rm to permanently delete it
Code:
rm "/Volumes/Macintosh HD – Data/Users/YourUserName/Desktop/hosts"
Replace YourUserName with your macOS user name.
 
  • Like
Reactions: jmat46

jmat46

macrumors newbie
Original poster
Aug 1, 2023
27
1
I can create a new account and delete the old one, since I don't have a recent backup.
 

NoBoMac

Moderator
Staff member
Jul 1, 2014
6,017
4,634
The provenance attribute is a bit of a clue. Appears the file was downloaded at some point in time. Maybe this link will help figure this out (did not do a deep read), but appears the file is "quarantined":


  • Ventura introduces a new extended attribute com.apple.provenance, attached to apps when they clear quarantine.
  • The xattr contains binary data of 11 bytes that is unique to that quarantine event.
  • The xattr is protected by SIP, so can’t be removed unless the app is copied to another volume.
  • It’s otherwise undocumented, and its purpose and use are unknown.

Was able to copy hosts to my Desktop and delete it, no problems:

Code:
% ls -lae@
-rw-r--r--@ 1 myidhere  staff  213 Aug 12 15:59 hosts
    com.apple.macl     72 
%
 
  • Like
Reactions: jmat46

bogdanw

macrumors 603
Mar 10, 2009
5,838
2,835
In Ventura 13.5, com.apple.provenance appears on the original /private/etc/hosts and the copied files has com.apple.macl aded, but it doesn’t prevent the file from being deleted.
hosts.jpg
 
  • Like
Reactions: jmat46

jmat46

macrumors newbie
Original poster
Aug 1, 2023
27
1
Do you have any special security settings?
I need to modify the hosts file and I remember that the same thing happened to me a while ago, repairing permissions I was able to eliminate it, but since Apple's operating system is becoming more closed every time...
 

bogdanw

macrumors 603
Mar 10, 2009
5,838
2,835
Try
Code:
sudo chflags nouchg ~/Desktop/hosts
sudo chflags noschg ~/Desktop/hosts
sudo rm -f ~/Desktop/hosts
 
  • Like
Reactions: jmat46

jmat46

macrumors newbie
Original poster
Aug 1, 2023
27
1
Captura de pantalla 2023-08-13 a las 21.09.12.png
I am not even able to modify the original document with root privileges and neither delete it, the problem is lack of permissions
 

bogdanw

macrumors 603
Mar 10, 2009
5,838
2,835
It appers as if you are trying to run multiple commands at once. Don't do that.
If you want to edit hosts, Gas Mask 0.8.6 https://github.com/2ndalpha/gasmask works in Ventura. I've tested it earlier today on Ventura 13.5, default security settings.
But hosts is no longer a reliable way to do anything in current macOS versions. What are you trying to achieve?
 
  • Like
Reactions: jmat46

jmat46

macrumors newbie
Original poster
Aug 1, 2023
27
1
it won't let me either... being blocked doesn't let me do anything. i want to block some ip
 

chrfr

macrumors G5
Jul 11, 2009
13,592
7,136
it won't let me either... being blocked doesn't let me do anything. i want to block some ip
You need to enter those 3 commands one at a time, pressing return in between. In particular, it seems as though
Code:
sudo chflags noschg ~/Desktop/hosts
should allow you to delete the file that's on your desktop.
 
  • Like
Reactions: jmat46

jmat46

macrumors newbie
Original poster
Aug 1, 2023
27
1
It has not let me, but I will comment on how I was able to solve it... I had a Ventura installation on an external hard drive, and from there and with the root user I copied and pasted it to the internal hard drive, and the lock has already been removed .
 

jmat46

macrumors newbie
Original poster
Aug 1, 2023
27
1
By the way, can you tell me about any maintenance or permit repair program?
 

bogdanw

macrumors 603
Mar 10, 2009
5,838
2,835
i want to block some ip
Use a firewall
LuLu is free https://objective-see.org/products/lulu.html
Little Snitch can run in Demo mode https://www.obdev.at/products/littlesnitch/download.html
"Without a license key, Little Snitch runs in demo mode, which provides the same protection and functionality as the full version. The demo runs for three hours, and it can be restarted as often as you like."

By the way, can you tell me about any maintenance or permit repair program?
“OnyX is a multifunction utility that you can use to verify the structure of the system files; run miscellaneous maintenance and cleaning tasks; configure parameters in the Finder, Dock, Safari, and some Apple applications; delete caches; remove certain problematic folders and files; rebuild various databases and indexes; and more.”
https://titanium-software.fr/en/onyx.html
 
  • Like
Reactions: jmat46
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.