File (folder) permissions when building packages with Composer

When building a package you may need to adjust the permissions of files or folders within the package source accordingly to ensure that the package works properly when deployed to the client. Before that, let’s take a look at the permissions of files and folders in the Apple file system.

 

Commonly, a file or folder will have three types of ownership: Owner, Group, and Everyone:

– Owner-Creator and owner of the file or folder.

– Group-By default, this ownership will be inherited from the parent directory, so most of them belong to staff, wheel, admin, etc. The Group setting is used to set the access privileges for other users who are not the owner of the file or folder.

– Everyone-Everyone setting is used to set the access rights of anyone who is not the owner and does not belong to the group.

 

After understanding ownership, let’s understand permissions.

 

For files:

– Read and Write-Users or Group members can open files and save changes.

– Read Only – Users or group members can open files, but cannot save changes.

– No Access-Users and group members do not have access to the file.

 

For folders:

– Read and Write-The user or group member can browse and change the contents of the folder.

– Read Only-The user or group member can browse the contents of the folder, but cannot change the contents of the folder.

– No Access-Users or group members do not have access to the contents of the folder.

 

The following figure shows the default permissions of the application folder in the system. root is the owner of the folder and has read and write permissions, admin group has read and write permissions, and everyone has read-only permissions. Normally any user on the system can access and run all applications in this directory.

After the software is installed in the specified directory, the owner permissions are usually root or the current account. You need to configure the correct owner, group, and everyone else’s permissions when building the application package source, as shown in the following figure.

Since the app itself is an expandable package within macOS, you can view all the files and folders it contains by right-clicking on the app and selecting “Show Package Contents”, as shown below.

So you also need to inherit the adjusted permissions to all its subdirectories of folders or folders, usually we will select the previous system directory where we need to package the software (e.g. Applications ) and inherit its permissions to all its subitems, as shown below.

At this point, you have completed the setup of permissions, the next according to the actual needs of the package format you need to create to complete the package.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>