About Mac computer’s file permission

permission

I was trying to install Joomla on my Macbook Air under XAMPP. I successfully installed it, but when I try to open the front-end, I keep getting this mkdir():permission denied error.

Two questions raised while I was trying to solve this problem:

  1. I noticed when I do ls -l, the owner/group of some folders is myname:admin, while those of other folders is root:admin. I am the only user of this computer and the myname user should have all root privileges.

    What I don't understand:

    A. Why when I do chmod I had to sudo chmod.

    B. Why there are folders with different owner.

  2. To solve the problem, I forcefully changed owner/group of all related files and directories to root:root and permissions of those to 0777. But eventually I will have to move this over to a production server and it is not wise to keep the owner and permission like this. Is there any better way to solve the problem while keeping the owner/permission settings as tight as possible?

Best Answer

sudo is needed to change permissions of files and folders that the current user account does not have permissions to modify.

In this case, the chmod myname required sudo because some of the files and folders being modified were owned by root.

By default, the first user account is an administrator. This is likely the account you are currently using. Administrator permissions are not equivalent to those of root. root exists above administrator users on OS X.

With regard to how best to deploy Joomla on a production server, this is better asked in a separate question.