Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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.

share|improve this question

2 Answers 2

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|improve this answer

The short answer here is that as far as I am aware there is no undo command but you can use sudo chown and sudo chown -R to set the permissions you want.

So I guess the only informaton you need is what the default permissions should be. From my machine Ubuntu 12.04, which has not been modified so should still be default

    warren@dell:~$ ls -la /var
    total 56
    drwxr-xr-x 14 root root     4096 Feb  7 21:20 .
    drwxr-xr-x 23 root root     4096 Feb  1 13:09 ..
    drwxr-xr-x  2 root root     4096 Feb  7 09:48 backups
    drwxr-xr-x 20 root root     4096 Oct 10 20:05 cache
    drwxrwsrwt  2 root whoopsie 4096 Jan 29 07:35 crash
    drwxr-xr-x  2 root root     4096 Aug 17 23:08 games
    drwxr-xr-x 70 root root     4096 Jan 29 19:15 lib
    drwxrwsr-x  2 root staff    4096 Apr 19  2012 local
    lrwxrwxrwx  1 root root        9 Feb  7 21:20 lock -> /run/lock
    drwxr-xr-x 16 root root     4096 Feb  8 12:37 log
    drwxrwsr-x  2 root mail     4096 Aug 17 23:05 mail
    drwxr-xr-x  2 root root     4096 Aug 17 23:05 opt
    lrwxrwxrwx  1 root root        4 Feb  7 21:20 run -> /run
    drwxr-xr-x 10 root root     4096 Sep 25 20:14 spool
    drwxrwxrwt  2 root root     4096 Feb  8 12:34 tmp
    drwxr-xr-x  2 root root     4096 Nov 10 16:56 www

The permissions for the /var directory should be

    drwxr-xr-x  14 root root  4096 Feb  7 21:20 var
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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