0

Possible Duplicate:
Allow specific user permission to read/write my folder

I have a folder, /home/oliver, which is the home directory for my user oliver. I am going to set up a file server and would like the apache user to be able to read from this folder.

At the moment the apache user can’t see this folder at all.

What are the commands to do this? I’m new to Linux so I don’t understand the concept of groups etc.

Oliver Joseph Ash
  • 312
  • 1
  • 5
  • 18

2 Answers2

1

If you have ACL's enabled, then a quick way would be to set an ACL for Apache, as in:

setfacl -m u:apache:r /home/oliver

For additional details man setfacl and man getfacl.

Kjuly
  • 498
Tony
  • 11
1

You have a group oliver which is the current group of your home folder. You need to add apache to this group. Use usermod -a -G oliver apache as root (probably using sudo) to add the apache user to the group oliver. You will need to restart apache (or your machine) to apply the change.

After this you can control the permissions with the group permission. Write access isn't usually given by default to other group members, so you may want to run chmod -R g+w /home/oliver. That adds write permission (+w) for other members of the group (g), recursively (-R). You own the folder, so you do not need sudo for that.

Keep in mind that apache may not run under the username apache. It may be something such as www, www-data, or webuser. Either check top/ps to see what it is running as, or run cat /etc/passwd and see which user looks like apache uses it. More specific instruction would require what distribution you are running and what version.

ssmy
  • 1,435
  • 1
  • 10
  • 9