How do I restore the default permission on a directory/folder?

7,212

The quick answer is that you're screwed. There is no undo. Be careful what you do with sudo. The quick solution is to reinstall.

But as this is just /var we could perhaps try to fix it. I could for example run this command on my system:

 find /var -exec stat --format "chmod %a %n" {} \; > /tmp/restoreperms.sh

This would give a script that you could run, and would try to reset all permissions as they are on my system. This should fix most issues. But I'm not sure how similar my installation is, as I'm using 12.10.

Share:
7,212

Related videos on Youtube

Viswa
Author by

Viswa

Updated on September 18, 2022

Comments

  • Viswa
    Viswa over 1 year

    I am using ubuntu 10.04,I need to give execute permission in www folder.But by mistake i gave execute permission in whole var folder.

    sudo chmod -R 777 /var
    Then i try to change it into normal permission.For that i gave
    sudo chmod -R 775 /var/
    And again i gave execute permission only www folder.But the problem is my index.html file is not run which is located in inside the www folder. How to restore the default permission on the /var directory/folder.