Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I’m running a webserver and FTP server, wherein /var/www is bound to /home/user/www.

I set both directories to chmod 777 (which is fine since it’s for testing only).

I can upload files into /home/user/www, but whenever I create a new directory, I always have to run chmod 777 on that folder.

Otherwise, when I try to browse it, I get the error message

You don't have permission to access /test/ on this server.

Is there a way I could make all sub-folders inside /var/www be accessible by anyone? Or could their permissions be automatically set to 777? It’s annoying that I have to type chmod 777 every time.

share|improve this question
Just going to leave this here PLEASE CONSIDER NOT USING 777 ON A WEB SERVER. A better question to ask is "How can I get my webserver to work without using 777 permissions?" – Marco Ceppi Jun 3 '13 at 14:35
sorry that is bad practice and I refuse to answer this :) Hope eveyone agrees :) – Rinzwind Jun 3 '13 at 14:36

This is bad practice, but hopefully you are just using this for development, or you have another good reason. You can specify the permissions when you create a directory using the -m option:

mkdir -m 777 dirname

Or you can set the permissions recursively.

sudo chmod -R 777 /var/www

Before using either of these, really consider if you want your filesystem to be so accessible.

Edit: As mentioned by Rinzwind here is a better way of accomplishing what you want.

Check what group owns your /var/www directory and add your user to that group.

sudo adduser yourusername group

The group is probably www-data.

Then you will be OK with setting your permissions to 775.

share|improve this answer
This does what you have asked for but please read this first Why should /var/www not have chmod 777. It is really not recommended practice. – Warren Hill Jun 3 '13 at 14:56
Please do not help people with a method that is bad practice. I would prefer if you explained how to do it: by adding his user to a group www-data or apache ;) – Rinzwind Jun 3 '13 at 15:03
Education comes first. Helping people screw up their machine is not the Linux way. So I strongly disagree with you. – Rinzwind Jun 3 '13 at 15:39
The asker did say this is only for testing. I can definitely understand wanting your development side to be easily accessible so you can work more quickly. I am going to give him the benefit of the doubt, that he is not foolish enough to do this with a production server. – dan08 Jun 3 '13 at 16:18
@dan08 There are better ways to test, including using your home directory. See… and… . There are secure ways to accomplish these goals ;) – bodhi.zazen Jun 3 '13 at 17:44

Your Answer


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.