What happens if I edit a duplicate Hosts file

filesystemhostsroot

What exactly is a duplicate file?

When I wanted to edit the hosts file (/private/etc/hosts), it says:

You don't own the file "hosts" and don’t have permission to write to
it.

You can duplicate this document and edit the duplicate. Only the duplicate will include your changes.

So, if I do my edits in the duplicate hosts file, is it equivalent to having my hosts file edited?

Best Answer

This is a poorly chosen vocabulary since in a MacOS X file system a duplicate is a serious error meaning that the file-system is deeply corrupted.

The correct term which should have been used here is the term of copy.

If you don't have permission to edit /private/etc/hosts then make a local copy as follows:

cp /private/etc/hosts ~/hosts

If you really need to edit the /private/etc/hosts, I advise you to make first a backup local copy as above. And once you have edited and thoroughly verified it, put it back into place with sudo to get the admin priviledges:

/usr/bin/sudo cp ~/hosts /private/etc/hosts