Trusted Solaris Developer's Guide

Assigning File Privileges using a Script

How to write privileged scripts to be deployed and used by others in your organization is described in Trusted Solaris Administrator's Procedures. This section briefly explains how to create a script that uses setfpriv(1) to assign forced and allowed privileges to an executable file for testing and debugging an application during application development.

First of all, the user or role you are working in needs a profile with the setfpriv(1) command and file_setpriv privilege assigned to it. The Object Privilege Management profile in the default system has these. To run the script from any shell and have the commands invoked by the script run under the profile shell and inherit your profile privileges, invoke pfsh(1M) at the top of the script as shown in the example below.

The example assigns forced and allowed privileges to executable. The -s -f options set forced privileges on executable, and the -a option sets allowed privileges on executable. This script will quit with the error: executable: not owner unless the file_setpriv privilege is inherited by the commands.

#/bin/pfsh
setfpriv -s -f 
ipc_mac_write,proc_setsl,sys_trans_label -a 
ipc_mac_write,proc_setsl,sys_trans_label executable

When you use a script to put forced and allowed privileges on an executable file, keep the following points in mind:


Note -

Always test the program at all labels at which it is intended to run.