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

This question already has an answer here:

When I write this to give permission to www directory:

zeb@zeb-Lenovo-B570:/var$ chmod 251 www/
zeb@zeb-Lenovo-B570:/var/www$ ls

Its gives error:

ls: cannot open directory .: Permission denied

I want to give permission to www folder so that I put my .php file here.
Help ?

share|improve this question

marked as duplicate by karel, Warren Hill, Eric Carvalho, Florian Diesch, Alvar Nov 27 '13 at 23:55

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

up vote 1 down vote accepted


`sudo chmod 755 /path/your/folder`

provide your password

or use this for assigning permissions recursively for sub directories.

sudo chmod -R 755 /pat/your/folder

or open nautilus with permission by

sudo nautilus 

and go to your desired folder ,right click on it and finally change its permissions as per your need.

to see permission allowed use

ls -l

it will show permissions of all the folders in Working Directory.

share|improve this answer
I got this. But In www folder how I give permission to PHP_Work directory in which I save .php files. – Zeb Nov 27 '13 at 5:23
then use chmod -r 777 /path/to/folder instead , for giving permissions to subdirectories recursively or use 755, try both am not damn sure.. – Sushantp606 Nov 27 '13 at 5:28
priviously used 251 is for allowing –w-r-x–x , and 777 will give read and write permission to everyone. – Sushantp606 Nov 27 '13 at 5:31
I write this , it work well: zeb@zeb-Lenovo-B570:/var$ sudo chmod -R 775 www – Zeb Nov 27 '13 at 6:01
if it solved your problem , accept it as an answer for future reference for others. – Sushantp606 Nov 27 '13 at 6:03


sudo chmod 755 /var/www/

sudo gives you administrative permission as /var is under root directory.

share|improve this answer
when I write this: zeb@zeb-Lenovo-B570:~$ sudo chmod 755 /var/www/ It's not give permission to create new directory in it – Zeb Nov 27 '13 at 5:26
Right now root is the owner of /var/www directory. Change the ownership of that directory to your user account by following command sudo chown -R "YOUR_USER_ACCOUNT" /var/www. After that you have all the permission over that directory. – Sambit Nov 27 '13 at 6:02

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