11

I just installed Ubuntu 12.04 in a pendrive, then installed MySQL and Apache PHP and then I tried to install Moodle (a distance learning platform I use at work). The installation in Moodle stopped when the program tried to create a folder called moodledata inside the folder /var, and did not have permission to do so. So I did a chmod 777 to folder /var and removed the blockade, but I fear what I have done is not safe and I want to go back to the previous (initial/default) permission value of /var I can't find anywhere what value should it be. Can you help me?

4 Answers 4

9

The default permission for /var is 755 = rwxr-xr-x: readable and executable (you need both for a directory) by everyone, and only writable by root.

Setting the permission on a file or directory to 777 is never right. In your case, you should

  • either have created the directory as root and then set its ownership to the user running Moodle (is this a web application? Then either www-data if the web application is supposed to write to this directory, or root if not);
  • or have configured the application to use a directory it can write to (e.g. under /var/www for a web application).
6

rwxr-xr-x.
owner can: read, write and Execute
owner group can : read and execute
others can : read and execute

1

result of command : ls -l /var in Fedora 17 :

drwxr-xr-x.  2 root root  4096 Jun  9 19:34 account
drwxr-xr-x.  2 root root  4096 Feb  3 13:58 adm
drwxr-xr-x. 19 root root  4096 Jun  9 18:44 cache
drwxr-xr-x.  3 root root  4096 Jun 13 19:55 db
drwxr-xr-x.  3 root root  4096 Jun  9 19:34 empty
drwxr-xr-x.  3 root root  4096 Apr 26 18:58 ftp
drwxr-xr-x.  2 root root  4096 Feb  3 13:58 games
drwxrwx--T.  2 root gdm   4096 Jun  9 03:35 gdm
drwxr-xr-x.  2 root root  4096 Feb  3 13:58 gopher
drwxr-xr-x. 55 root root  4096 Jun 28 16:19 lib
drwxr-xr-x.  2 root root  4096 Feb  3 13:58 local
lrwxrwxrwx.  1 root root    11 Jun  9 19:18 lock -> ../run/lock
drwxr-xr-x. 22 root root  4096 Jul  7 22:22 log
lrwxrwxrwx.  1 root root    10 Jun  9 19:18 mail -> spool/mail
drwxr-x---.  6 root named 4096 Jul  4 19:53 named
drwxr-xr-x.  2 root root  4096 Feb  3 13:58 nis
drwxr-xr-x.  2 root root  4096 Feb  3 13:58 opt
drwxr-xr-x.  2 root root  4096 Feb  3 13:58 preserve
lrwxrwxrwx.  1 root root     6 Jun  9 19:18 run -> ../run
drwxr-xr-x. 17 root root  4096 Jun  9 19:38 spool
drwxrwxrwt.  4 root root  4096 Jul  8 00:36 tmp
drwxr-xr-x.  8 root root  4096 Jun  9 19:34 www
drwxr-xr-x.  3 root root  4096 Jun  9 19:26 yp
1

I agree with what Gilles has said, and what you will want to do, is like you changed the permissions of the /var file, you can do the same back.

Like this is probably what you did:

chmod 775 /var

You would want to do something like this:

chmod 755 /var

How are examples of the permissions in numbers:

rwxrwxr-x = 775

rwxr-xr-x = 755

I hope you can get it sorted out.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .