Apple Event: May 7th at 7 am PT

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

How to set all file permissions to default?

So a few background notes are in order. I came across an article on the NSA's website titled Hardening Tips for Mac OS x 10.6 "Snow Leopard", needless to say I have come to believe I have made this irreversible. The NSA suggested to do some fancy command line coding to disable this, modify that, and change permissions to this. After hours spent on "hardening" my system, I have little hair left to pull in frustration. Is there any way to restore all file permissions back to default? I have used the Repair Disk Permissions, but that has done very little. To give the scope of what permissions have been skewed, I have observed several things:


  1. The desktop wallpapers, on all Desktops (as I'm in Lion 10.7.3), start from the same picture every time. I have the wallpapers changing, randomly, every 5 minutes.
  2. Safari doesn't keep the home page. No matter how often I try to change the homepage, I restart Safari, and I'm right back to the original homepage.
  3. Firefox doesn't retain the fact that I want it to be the default Web Browser. In fact, it keeps "forgetting" that I've used it before, and thus brings me to their awesome start page whenever someone first uses Firefox.
  4. Spotlight gets "stuck" i.e. almost every time I start my machine, it indexes. Even after I let it finish indexing, the next time I start my computer, it starts again.
  5. I have to input the administrator password after almost every activity, such as copying to the desktop, moving an application not bought from the Mac App Store into the /Applications folder, deleting a file from anywhere inside my home folder, etc.
  6. Some preference panes that need access to certain folders, such as Hazel's access to my desktop, are denied that access without ever prompting me for a password (though even if it did, it would get rather annoying after every startup)
  7. My firewall (in System Preferences>Security & Privacy>Firewall) doesn't "remember" that I do indeed want Dropbox to accept incoming connections. I have to input my admin password at each startup after clicking "allow"
  8. Opera pretty much doesn't function. Its bookmarking capability, home page, saved tabs, any thing that requires the saving of any type of preference to the computer results in a dialog pop up informing me that Opera failed to save what it needed, and prompts me to "Try again" or "Cancel" (hint: the "Try again" button doesn't work)


There are more symptoms of an ever growing problem.


I have backed up my machine from Time Machine, but I think it retains these file permissions, unless I'm wrong.


Summary:

How can I fully restore EVERY file permission back to default? Repair Disk Permissions doesn't work

Is there a way that I can re-install Mac OS X, restore through Time Machine, and achieve the default file permissions, essentially losing all file permissions?

MacBook Pro (15-inch Early 2011), Mac OS X (10.7.3)

Posted on Feb 22, 2012 10:45 AM

Reply
22 replies

Feb 22, 2012 2:54 PM in response to Linc Davis

My deepest apologies. I shouldn't be making it cryptic to those trying to help.


Is there any way that I am able to have my system back to default while still keeping my files? As in, undoing all of the havoc I've caused. Could this be accomplished by manually copying files from the HDD, re-installing Lion, and then manually copying them back to their "original" place?

Feb 22, 2012 3:04 PM in response to SeeYa32

Hello SeeYa32,

you can launch, from the Disk Utility, a Verify/Repair permissions, that will check and repair system privileges.


See -> http://support.apple.com/kb/HT2963


To restore permissions on the home folder you can also use the Reset Password in the Lion Recovery.


To do that you start up from Lion Recovery System (Command-R during startup), then choose Utilities>Terminal from the menu, then in the terminal type 'resetpassword' and then press the return key. This will open the Reset Password utility, where you find at the bottom a "Reset Home Folder Permissions and ACL" button.


You have to specify the volume and the user accout home you want to reset and, when it finishes, exit the terminal and restart the mac in a normal way.


:-)


Ciao


Nicola

Feb 22, 2012 3:16 PM in response to SeeYa32

If you have fixed the permissions of the files in your home folder and then backed them up with Time Machine, then they'll still be fixed when you restore from Time Machine. I'd expect Time Machine to be working, despite your other problems, because its permissions would be fixed by Disk Utility. The permissions of Chrome and other third-party software have not been fixed, which is why it's not working. This thread is getting rather long, so I'll wish you good luck.

Feb 22, 2012 3:19 PM in response to SeeYa32

To move the home, in the Users&Groups, you can select your user and delete it, the system will ask you what to do with the home folder, you tell him to "save it to disk image", then you save the image in an external drive/disk.


Reinstall the system (or install a new system) from scratch and:


- during the migration assistant, use the disk to reimport all datas from the image


or


- you can proceed with the initial setup, by specifying an initial user which has a different name of yours, then you copy the image in the \Users folder, create your user and, since it has the same name and will use the same path for the home, the system will ask you what to do with the home...you tell him to reuse the existing one and ta-dah! :-)


You will have then to fix the keychain (but since you know the old password this should be no problem)...

May 1, 2012 1:35 PM in response to Linc Davis

Thanks so much to Linc.


I tried so many things from so many threads and then attemped the steps above but got all the 'invalid arguement' lines in terminal.


I then tried

chflags -R 0 ~ and tried the reset ALC steps again and everything seems fine now.


I wish I understood exactly what was happening whilst taking these steps but the main thing is that the permissions seem ok again.


Thanks so much again Linc.


One thing that really puzzled me though, was this: When I first had this problem I thought it was my HD. On that HD the cmd R allowed me to access the recovery partition. I decided to restore from a 1 day old TM back up, but did this onto a spare HD I had.


Despite the successful restore, the cmd R keys did not work with the spare HD. I had to boot from the DVD. No idea why.


Anyway, I hope this never happens again!

May 6, 2012 12:20 PM in response to amd1

Hello Linc -


I have a very similar problem. I have a Macbook Air, and Mac Mini and a MacBoook Pro. I can write from my Macbook Air to my Mini, I can write from my mini to my Macbook Air.... I can't write from either one of those to my Macbook Pro. I can write from my MacBook Pro to the Macbook Air and the Mac Mini and I can copy from the file sharing in the Macbook Pro files from both the Macbook Air and the Mac Mini.... I just can't write any files from my Air or Mini to the Macbook Pro.


Every time I do, it asks me for my user permission password. I enter the password and I get the error message a null file already exists and the file does get replaced, but with no data - it's a zero byte file and has nothing but the file name.


I've done every single step you've noted and all w/ no results. Spent a half hour on the phone w/ Apple support and they basically walked me through your steps - all to no avail.


One question I have that I do not see any relationship to is; do the permissions need to be reset for all the computers or just on the Macbook Pro? I don't want to go and screw up my other permissions with the other two computers as they communicate fine with each other. What gives?

May 17, 2012 12:16 PM in response to SeeYa32

Lol. I totally did this too.

I did the chmod -v -R -N [directory you want to change permissions of; @Linc said ~ which means home folder; but this assumes that you were logged in as the user that you wanted to change the permissions of).


Here's what I did- a walkthrough.


(in terminal)

(stuff in () is substitutable info that is personalized for your computer. stuff that follows $ are commands that you type. the other stuff are examples of the data that terminal will return after you type the commands (and then hit enter)).

$pwd

prints where you are

/Users/(user you're logged in as)


$cd /Users/

navigates to the Users directory


$ls -Fhl

lists all of the files (even the hidden ones) in the directory that you're currently in, and displays ownership info.

/Shared

/userA/

/userB/


$ls -le

lists all of the files (like above) but shows exactly which actions users/groups can do.


drwxrwxrwt 6 root wheel 204 Apr 29 16:56 Shared


drwx------+ 21 (user Name) staff 782 May 17 13:13 (File/Directory name)

0: user:flashbacktrojan allow list,add_file,search,add_subdirectory,delete_child,readattr,writeattr,readextat tr,writeextattr,readsecurity

1: group:admin allow list,add_file,search,add_subdirectory,delete_child,readattr,writeattr,readextat tr,writeextattr,readsecurity


if you have more users it'll display more stuff like the previous one.




Ok, so now that you know which files have which permissions--by the way, all of the stuff above so far isn't dangerous at all. For most stuff that's serious you have to preface the command with sudo or su-- we can do what Linc said.


If you're logged in as a non-administrator user:


$su -l (username of the administrator)

substitutes user identity...essentially su -l will simulate a what terminal would be like if you were logged in as the administrator...I'm pretty sure that part of hardening osx includes creating an Administrative user and then changing your normal user that you use on a regular basis to a Standard user.


Password:

(enter in your admin's password and then hit return)



Ok. Here's where you get into risky territory. Using sudo isn't a joke, you can very easily corrupt important stuff if you just go sudoing and doing stuff when you don't know what you're doing.


$sudo -i

Password:

(enter in admins password again)


NOW you're important. be very careful what you type from here on out.


terminal should now look like

Dudes-Mac-Pro:~ root#

$cd /Users/

(changes into /Users/ directory (the directory is literally called Users.)


$ls

(again this lists the files in the current directory)

.hiddenfile Shared (user1)

.anotherhiddenfile (user2) (etc)


ok. Now we're going to change stuff.


$chmod -R -N (name of the user's home directory you need to change the permissions of)

(in my case

$chmod -v -R -N Dude/

)


Now wait a few minutes. don't type anything. go get a cup of coffee or something.


now you should see:

Dudes-Mac-Pro:Users root#


$exit


now you should see:

(user)$


you're done. close terminal. You can also check to make sure all is well by:

$ls -Fhl


You'll see something (again) like:

drwxrwxrwt 6 root wheel 204B Apr 29 16:56 Shared/

drwx------+ 21 user1 staff 782B May 17 13:13 user1sdirectory/

drwxr--r--+ 24 user2 staff 816B May 17 12:56 user2sdirectory/


go on your marry way.

Just to be clear; you don't HAVE to back everything up before doing this, Linc was just being careful- justifiably.

How to set all file permissions to default?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.