I accidentally ran chmod 777 * in my home folder and it changed all the directory permissions (but not for the files).

How can I undo this?


Best to run this:

sudo chmod -R a+rwX,o-w /home/$USER

All directories will be 775. All files will be 664 except those that were set as executable to begin with. $USER is your name which normally is a system variable.

echo $USER

This discusses one specific error, but also has the suggested defaults.


More info on permissions:


| improve this answer | |
  • 1
    As the OP has only changed the permissions on the home directory's level (he/she didn't use recursion) I don't like the idea to 'correct' this with a recursive chmod command. Perhaps there were permissions somewhere below that shouldn't be reset. – muclux Jul 15 '18 at 9:02

The default permissions for the home folder is 755 :) Run chmod again as last time.

chmod 755 *
| improve this answer | |

While chmod -R is good in some ways, I find it lacks some control. I prefer to use find in conjunction with chmod. To reset only your directory permissions, you can do something like the following (assuming you're logged in as the owner):

cd /home/$USER
find . -type d -exec chmod -fv 755 {} \;
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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