I've lost administrator access and /var/db/.AppleSetupDone is read only
I have lost administrator access after trying to change my username in system preferences and restarting.
I have followed the directions by rebooting in Single user mode, ⌘S and typing the following commands:
/sbin/fsck -fy
/sbin/mount -uw /
rm /var/db/.applesetupdone
It then asks if I want to override rm /var/db/.applesetupdone
and if I then type "YES" it says that it is a read only file and nothing happens.
I have also tried typing rm /var/db/.applesetupdone
in terminal and again it asks me if I want to override, and again answering YES I get the reply Permission denied:
override r-------- root/wheel for /var/db/.applesetupdone? YES
rm: /var/db/.applesetupdone: Permission denied
I am using MacOS High Sierra Version 10.13.4
How do I remove applesetupdone or get administrator privileges back?
Solution 1:
You can run the command as superuser (explanation on wikipedia)
Either run
sudo rm /var/db/.applesetupdone
or
su
to log in as super user and then regularly run the commands.