opening permissions on certain files on my own computer
I am working on a 27" iMac running 0SX9.5.
I am trying to edit certain system files, specifically those tied to time machine, and have run into certain blocks which I am trying to understand and bypass.
I was trying to edit the com.apple.backupd-auto.plist file. I opened it, made some changes but was unable to save it afterwards. I received an error, "...You don't have permissions..."
I checked my permissions using "find info" button AND listing permissions in terminal, "ls -l". I was logged in as the root user (admin). In both places my permissions was listed as read only. In both places I changed my permissions to rw (and x in terminal). I could see my permissions change to rw(x), but I still could not change anything and received the same error, "...You don't have permissions..."
After more research, I tried a sudo command to alter the plist. I noticed two things. One, the change after I used the command was added to the plist, but as a new line/entry. Two, the permissions changes I had made previously were wiped away and only the user "system" was listed with any permissions, rwx.
I am assuming this means that the "system" (apple) has locked these files and I have zero control over them. Is this the case? If not, what am I missing? I assumed changing permissions thru terminal was the strongest way and would be permanent. If so (that I am locked out), is there any way around this?
I did note that using the "sudo defaults writes" command seemed to add new entries to the plist. The entries where new, stand-alone lines in the plist. My error seems to have been that the entries I'm trying to change are sub listings and I didn't provide the direct path in my command. Can anyone tell me, when using this command, how to type in the path to the sub entries? To reiterate, if the plist value I was trying to change was a key, "com.apple.xxxx", listed under the key MachServices, how would I type this path in?
All comments and advice, or alternatives commands, appreciated as I am not very skilled at permissions, plists and using terminal to manipulate them, and would like to learn as much as possible.
The normal permissions for that file on my macOS 10.12.3 Sierra Mac are:
-rw-r--r-- 1 root wheel 1.4K Aug 11 2016 com.apple.backupd-auto.plistso it does look writable by root, but I have found that sometimes you need to copy a protected file to a place that you can write to it, change it, and them move it back like this:
Thank you, John, your response was very useful.
First off, I had found superuser.com's website, but I was looking to do the fix myself, not bring in another program to do it. This is my way of learning more about programming, Mac os, etc. I still have some work to do to gain control on my own of Timemachine, but I'm working at it.
Your note on copying, editing then moving the file back finally did work. The plist is edited. I had tried to copy, make the edits and then copy back, but it hadn't worked. I did it without the sudo command, just by changing permissions, and it hadn't let me make changes. Seems an obviously fix using sudo bit it hadn't clicked at the time. Thanks.
Also the script you provided in the second paragraph is the other thing for which I was looking. The use of ":" and how to write the command to edit specific sublevels within a plist.