Glam Prestige Journal

Bright entertainment trends with youth appeal.

My apache root /var/www/html/ contains the following folders.

  1. myapp
  2. test
  3. testapp

I want to create a new user to access only testapp folder (read/write). Other folders shouldn't be read.

I created a new user for for the group www-data (as www-data is the owner of the /var/www/html/) and I'm able to login via ssh as well. Now the problem is the new user is having access to all the 3 folders above. I need to restrict the user to have access only to testapp folder. (Other folders shouldn't be read by the new user)

Some people suggested to use chroot but it is unclear for me. Is there any way to restrict the www-data user only to a specific folder?

4

1 Answer

Let's call your new user testapp:

You have to remove read access for "other" of all files and folders. Issue the following commands:

  1. chmod -R o-r /
  2. chown -R :testapp /var/www/html/testapp
  3. chmod -R g+rwx /var/www/html/testapp

Remove your new user from the www-data group, but remember when www-data cannot read files, it won't be readable on your website

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy