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.

im running webserver and ftp server, where my /var/www is binded on my /home/user/www

i made both directory at chmod 777 (which is fine since its for testing only)

i can upload files inside /home/user/www but whenever i create new directory, i always have to chmod 777 that folder so i could just browse it. else, i get this

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

is there a way i could make all sub-folders inside /var/www to be accessible by anyone? or simply say just make it automatically to be chmod 777?

its kinda annoying to go inside that folder and type chmod 777 everytime.

share|improve this question
1  
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
4  
sorry that is bad practice and I refuse to answer this :) Hope eveyone agrees :) –  Rinzwind Jun 3 '13 at 14:36
    
add comment

1 Answer

This is bad practice, but hopefully your 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.

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 you /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
1  
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
3  
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
    
This is a good answer. Even if you are right and people shouldn't give solutions that may be harmful, this answers perfectly what is asked in the question. We need to consider that the people want to do what they want to do. And in certain cases the people needs explicit and direct answers to their questions, not alternatives. I am for using safe procedures and not allowing 777 permissions on /var/www but it is not what is being asked here. –  Geppettvs D'Constanzo Jun 3 '13 at 15:34
2  
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
1  
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
show 3 more comments

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.