In addition to restoring its contents, you may need to set its ownership and permissions: sudo chown root:wheel /etc/hosts
At this point, you may be able to recreate /etc/hosts. When the system boots, your sudo command might be working again, if you have not otherwise broken it. When the command prompt appears, enter these commands: mount -uw / If it does not, reboot your system and immediately press and hold the Command and S keys. I am not sure that will change the sudoers permissions. You might try opening Disk Utility, selecting the system volume, and clicking Repair Disk Permissions. You have broken your system by making inappropriate changes.įirst, you need to fix the permissions on /etc/sudoers.