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 think I have screwed up my permissions in Ubuntu.

I am using my server to run PHP. I recently ran across a problem where PHP could not create directories in the var/www-directory, so I searched around on the internet. Now PHP can write and access anything like it should, but as a user, I can't create new folders or files anymore.

Right now, the permissions for folders are like this:

drwxrwsr-x 2 www-data www-data [Folders]

This is the permissions when I upload using sftp:

-rw-rw-r-- 1 gautvedt www-data [Folders]

What have I done wrong and how can I change this?

share|improve this question
add comment

2 Answers

up vote 6 down vote accepted

You need to include yourself into the www-data group.

Graphical method

Command line:

sudo adduser gautvedt www-data

That way you can add things to directories where www-data owns the group.


There are more methods but this is the easiest one.

share|improve this answer
add comment

After add user to www-data group as mentioned by Rinzwind, you should change the permission to 755

sudo chmod 0755 -R /var/www

without changing permission, it can't be accessed (forbidden). So, it will change to

drwxr-xr-x 1 gautvedt www-data [Folders]
share|improve this answer
    
To me anything that does not need executing should be set to 644 and not 0755 ;) –  Rinzwind Oct 30 '12 at 11:07
add comment

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.