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?
744 is not normal for directories. I would believe it should be
6 for files. Where I prefer "0"/"0" for "others" and "5"/"4" for groups.
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
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
600or set the group to the name of the user and empty out the group from any other user.