Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

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 certain script that is using a non-root user to do the following...

mkdir: cannot create directory `/srv/www/'
*** [err ::] : 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.

share|improve this question

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/, you can change the user/group names if you need to.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .