1

I'm running macOS since several years and I have an auto_master file that contains my mounts config.

On a new Macbook, I cannot edit this file which is in the /etc folder and I have the following error: "auto_master" E212: Can't open file for writing. Note that I had already an auto_master file that I have deleted I don't know how (I had the same error message when trying to edit it) and that I can create files in the /etc folder.

Any idea how I can fix this issue?

Note: The error I have happens when I run sudo vim /etc/auto_master then I try to write the file. sudo touch /etc/test_file and sudo rm /etc/test_file work fine.

closed as off-topic by Christopher, Mr Shunz, Wouter Verhelst, Rui F Ribeiro, Thomas Jan 19 at 9:11

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions describing a problem that can't be reproduced and seemingly went away on its own (or went away when a typo was fixed) are off-topic as they are unlikely to help future readers." – Christopher, Mr Shunz, Wouter Verhelst, Rui F Ribeiro, Thomas
If this question can be reworded to fit the rules in the help center, please edit the question.

  • I should have mentioned that. The error I have happens when I run sudo vim /etc/auto_master then I try to write the file. sudo touch /etc/test_file and sudo rm /etc/test_file work fine. – radar Jan 17 at 20:43
  • Three first tests give No such file or directory. The last one gives 1. – radar Jan 17 at 21:10
  • 1
    Note that I have an auto_master\~ file and ls -lO command on it gives: -rw-r--r-- 1 root wheel compressed 194 6 mar 2018 /etc/auto_master~ – radar Jan 17 at 21:13
  • Already tried to move /etc/auto_master~ to /tmp/ and create a new auto_master with no success. Followed your advice to remove auto_master~ but with no success touch: auto_master: Operation not permitted. Cannot figure out what's happening. – radar Jan 17 at 21:21
  • I think the issue is that your terminal is not allowed to perform administrative tasks. I usually use iTerm2, where I got the same error. I started Terminal to copy auto_master back and MacOS asked me if I want to give Terminal administrative privileges, which I did. It worked. – lysium Mar 25 at 8:04
2

I managed to fix the issue by restarting in recovery mode, mounted the internal hard drive then copied the file. It's a workaround but it does not explain what's happening. Thank you very much Christopher.

Not the answer you're looking for? Browse other questions tagged or ask your own question.