I've been using Ubuntu Linux for a couple years now but I still have trouble with permissions.

I need to setup my web server for production. The root web directory should always be accessible by Apache and me (I login to ftp with my account) as well (if possible) by my CGI applications. I would like to hear your ideas of the best way to set something up like this in production.

Maybe what I've suggested isn't the best way to set this up even. If there's a better way to set things up for production (I plan to be using CGI scripts and compiled CGI binaries)


You will want to create a group and add all of the accounts to it that will need to access your web root directory. Once this is done then you will need to change the group for the folder and its contents.

You will definitely want to add the account that Apache is running under (usually apache) to the group as well as the account that will be executing the CGI scripts. If I recall correctly your ftp server will be accessing files as the account it is running as rather than the log in you are using when you access it.

To create the group you can use the following:

$sudo groupadd newgroup

To add users to the group use the following for each user:

$sudo usermod -a -G newgroup username

To change the group that the webroot folder belongs to:

$sudo chown -R currentowner:newgroup yourwebrootfolder

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.