How to give user read/write access to folders?

1

I'm running a certain script that is using a non-root user to do the following...

mkdir: cannot create directory `/srv/www/example.com/releases'
*** [err :: 12.23.45.789] : Permission denied

How would I allow user xyz to have permanent permissions to do so and still keep this web server secure? Also is it possible to make it recursive for all subfolders?

I know its probably chmod something but I'm not that linux savy, thanks.

Will

Posted 2012-09-27T21:12:03.503

Reputation: 11

Answers

1

The standard way is to make the user a member of the web servers standard group.

On Debian based servers, the web service generally has a user id of www-data and a group id of the same name.

The www sub-folders should all generally belong to this user/group.

Adding a user to the www-data group should allow that use to create and modify folders and files as required.

Of course, this means that the user has access to all of the folders owned by www-data which may not be right.

It would help if you gave us the output of a ls -l command on /srv/www/example.com/, you can change the user/group names if you need to.

Julian Knight

Posted 2012-09-27T21:12:03.503

Reputation: 13 389