File ownership and permissions

When mkifs includes files in the OS image, the permissions for these files are set according to the umask for the user building the image on the host system. You can use buildfile attributes to changes these permission.

The files that mkifs includes in an image inherit the owner, group ID, and permissions fields of the host filesystem they came from. They acquire the user ID and group ID fields from the user who runs the mkifs program, and receive the permissions set by that user's umask.

Changing file owner, group ID and permissions

To change these fields for particular files when they are included in the buildfile, you can prefix the filenames with the appropriate attributes. For example:

[uid=0 gid=0 perms=0666] file1
[uid=5 gid=1 perms=a+xr] file2

These lines mark the first file (file1) as owned by root (the user ID 0), group zero, and readable and writable by all (the mode of octal 666). The second file (file2) is marked as being owned by user ID 5, group ID 1, and executable and readable by all (the a+xr permissions).

Note: When running on a Windows host, mkifs can't get the execute (x), setuid (“set user ID”), or setgid (“set group ID”) permissions from the file. Use the perms attribute to specify these permissions explicitly. You might also have to use the uid and gid attributes to set the ownership correctly. To determine whether or not a utility needs to have the setuid or setgid permission set, see its entry in the Utilities Reference.

When you combine attributes, place them all inside one set of square brackets, as in the example above: [uid=0 gid=0 perms=0666] file1. See Buildfile syntax for more information about attributes and buildfile syntax.

If you want to set permission fields for multiple files, you can specify the attributes (uid, gid, and perms) on a single line, followed by the list of files. For example:

[uid=5 gid=1 perms=0666]
file1
file2
file3
file4

which is equivalent to:

[uid=5 gid=1 perms=0666] file1
[uid=5 gid=1 perms=0666] file2
[uid=5 gid=1 perms=0666] file3
[uid=5 gid=1 perms=0666] file4