0

I have installed LAMP on my Ubuntu Server while being user (say "test"). Then i switched to another user (say "user") and I have configured a virtual host. The virtual host directory at www/ has 744 permissions. When I try to reach the virtual host from the browser it says "You don't have permission to access / on this server.". When I changed the permission to the virtual host directory at www/ and made it 745 the host could be reached from browser. I suspect that this is because I installed apache as user "test". How can I change it so that it can open files that have -x permission only for owner while being logged in as the owner user?

  • 1
    Give it a permission of 775 rather than 745 – George Udosen Feb 1 '17 at 10:45
  • Actually I want to do it without changing the permission 744. – enu Feb 1 '17 at 10:59
1

744 is not normal for directories. I would believe it should be 7[750][50], and 6[640][40] for files. Where I prefer "0"/"0" for "others" and "5"/"4" for groups.

For 745 I doubt there is a valid usecase: permissions really should trickle down from user to group to "others" so the user has the most permissions and others should have the least.

How can I change it so that it can open files that have -x permission only for owner while being logged in as the owner user?

  • Add the user to the group that owns the directories and files and set permissions to 750.
  • Change the owner of those directories and files from "test" to the user.

    chown -R $USER /var/www/
    

    (assuming /var/www/ is your root; adjust accordingly) would do that. By the way: if you only want user to execute you should use 700 and 600 or set the group to the name of the user and empty out the group from any other user.

Your Answer

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

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