How to Delete a Project From the /etc/project File
This example shows how to use the projdel command to delete a project.
Become superuser or assume an equivalent role.
Roles contain authorizations and privileged commands. For more information about roles, see "Using the Solaris Management Tools With RBAC (Task Map)" in System Administration Guide: Basic Administration.
Remove the project booksite by using the projdel command.
# projdel booksite
Display the /etc/project file.
# projects -l system projid : 0 comment: "" users : (none) groups : (none) attribs: user.root projid : 1 comment: "" users : (none) groups : (none) attribs: noproject projid : 2 comment: "" users : (none) groups : (none) attribs: default projid : 3 comment: "" users : (none) groups : (none) attribs: group.staff projid : 10 comment: "" users : (none) groups : (none) attribs:
Log in as user mark and type projects to view the projects that are assigned to this user.
# su - mark # projects default
How to Validate the Contents of the /etc/project File
If no editing options are given, the projmod command validates the contents of the project file.
To validate a NIS map, type the following:
# ypcat project | projmod -f -- |
To check the syntax of the /etc/project file, type the following:
# projmod -n |
How to Obtain Project Membership Information
Use the id command with the -p flag to display the current project membership of the invoking process.
$ id -p uid=100(mark) gid=1(other) projid=3(default) |
How to Create a New Task
Log in as a member of the destination project, booksite in this example.
Create a new task in the booksite project by using the newtask command with the -v (verbose) option to obtain the system task ID.
machine% newtask -v -p booksite 16
The execution of newtask creates a new task in the specified project, and places the user's default shell in this task.
View the current project membership of the invoking process.
machine% id -p uid=100(mark) gid=1(other) projid=4113(booksite)
The process is now a member of the new project.
How to Move a Running Process Into a New Task
This example shows how to associate a running process with a different task and new project. To perform this action, you must either be superuser, or be the owner of the process and be a member of the new project.
Become superuser or assume an equivalent role.
Roles contain authorizations and privileged commands. For more information about roles, see "Using the Solaris Management Tools With RBAC (Task Map)" in System Administration Guide: Basic Administration.
Note - If you are the owner of the process or a member of the new project, you can skip this step.
Obtain the process ID of the book_catalog process.
# pgrep book_catalog 8100
Associate process 8100 with a new task ID in the booksite project.
# newtask -v -p booksite -c 8100 17
The -c option specifies that newtask operate on the existing named process.
Confirm the task to process ID mapping.
# pgrep -T 17 8100
Editing and Validating Project Attributes
You can use the projadd and projmod project database administration commands to edit project attributes.
The -K option specifies a replacement list of attributes. Attributes are delimited by semicolons (;). If the -K option is used with the -a option, the attribute or attribute value is added. If the -K option is used with the -r option, the attribute or attribute value is removed. If the -K option is used with the -s option, the attribute or attribute value is substituted.
How to Add Attributes and Attribute Values to Projects
Use the projmod command with the -a and -K options to add values to a project attribute. If the attribute does not exist, it is created.
Become superuser or assume an equivalent role.
Roles contain authorizations and privileged commands. For more information about roles, see "Using the Solaris Management Tools With RBAC (Task Map)" in System Administration Guide: Basic Administration.
Add a task.max-lwps resource control attribute with no values in the project myproject. A task entering the project has only the system value for the attribute.
# projmod -a -K task.max-lwps myproject
You can then add a value to task.max-lwps in the project myproject. The value consists of a privilege level, a threshold value, and an action associated with reaching the threshold.
# projmod -a -K "task.max-lwps=(priv,100,deny)" myproject
Because resource controls can have multiple values, you can add another value to the existing list of values by using the same options.
# projmod -a -K "task.max-lwps=(priv,1000,signal=KILL)" myproject
The multiple values are separated by commas. The task.max-lwps entry now reads:
task.max-lwps=(priv,100,deny),(priv,1000,signal=KILL)