MacOS – Change Apache root directory

apachemacospermission

I am having problems changing the Permissions on the "username.conf" file in the /etc/apache2/users/ folder. It needs to have the permission of
-rw-r--r-- 1 root wheel 298 Jun 28 16:47 username.conf
but I am not able to achieve this.

I have tried changing the permissions with the command
sudo chmod 644 username.conf;
and it didn't change.

I am using this tutorial: http://coolestguidesontheplanet.com/forbidden-403-you-dont-have-permission-to-access-username-on-this-server/

When I check the permission of the file, it's
-rw-r--r-- 1 root wheel 155 Jan 23 23:30 Owner.conf

When I navigate to http://localhost/~Owner/ , I get 404 Not found.

Best Answer

The permission command chmod 644 is actually working!

The permission of your file Owner.conf is -rw-r--r--.

The chmod command works by specifying (1) the permissions for the file owner - in this case root, (2) the permissions for anyone in the same group as the file owner - in this case the group is wheel, and then (3) the permissions for everybody else (global permissions).

For each of the three above groups of users, the possible permissions are read, write, and execute. Full permissions would look like this: -rwxrwxrwx.

The permissions are specified using binary notation. 1 means the permission should be set, and 0 means it should not be.

Thus, setting chmod 644 sets permissions 6 - or 110 in binary - for the file owner, and 4 - or 100 in binary - for the group and for everybody else.

This creates the permission string -110100100. This translates to: -rw-r--r--.

Note that in your question above, the username.conf and Owner.conf both do have permissions of 644.