How can I give my normal user access to read and write on directories created by root?

1

Just installed FreeBSD for a Webserver, and the www directory which was created by the 'root' user can only be managed and changed while running commands under su.

I understand that I need to add the group of my normal user to the groups that control the directory, but I don't really understand how do I do it.

Thanks.

Eran

Posted 2012-07-14T08:25:49.993

Reputation: 11

chmod 644 -r *.* (not sure about -r) – hjpotter92 – 2012-07-14T08:57:32.967

Answers

1

Normally you would achieve this by creating a user group

sudo addgroup writewww

add the user(s) who should have the access level to that group

sudo adduser username writewww

and then set the access premissions on the folder

sudo chown -R :writewww www
sudo chmod -R g=rwx www

(This will change the group owner of the www folder to writewww and then give the group read, write, traverse access on that folder)

If you want more control, you can user access control lists, but they're much more complicated.

Edit: That said, many Linux distributions' apache package now creates an apache group by default, so you can simply add users to that group. It would be great to see that in the Unix world.

billc.cn

Posted 2012-07-14T08:25:49.993

Reputation: 6 821

do you have any docs I can read about user access control lists? – Eran – 2012-07-14T14:38:54.817

I don't have much exprience with Freebsd though. This is the first result on google: http://www.freebsd.org/doc/handbook/fs-acl.html This is primarily a file system feature with some supports needed in the kernel, so many Linux related instructions may apply to BSD as well.

– billc.cn – 2012-07-14T17:18:37.720

0

There are at least 2 different things you can do. First of all, can you tell me under which user apache runs? Now, the first option and the most easy one is to change the directory permissions as:

chmod g+s <dirname>
chmod g+w <dirname>

Now, all you need to do is to add the user you want in the same group as the us

Peter

Posted 2012-07-14T08:25:49.993

Reputation: 279