<?Pub UDT _bookmark _target?><?Pub CX solbook(?><chapter id="rbactask-1"><?Pub Tag atict:info tracking="off" ref="0"?><?Pub Tag atict:user user="sharonr" fullname="Sharon Veach"?><title>Using Role-Based
Access Control (Tasks)</title><highlights><para>This chapter covers tasks for distributing the capabilities of superuser
by using discrete roles. The mechanisms that roles can use include rights
profiles, authorizations, and privileges. The following is a list of the task
maps in this chapter.</para><itemizedlist><listitem><para><olink targetptr="rbactask-14" remap="internal">Using RBAC (Task Map)</olink></para>
</listitem><listitem><para><olink targetptr="rbactask-15" remap="internal">Configuring RBAC (Task Map)</olink></para>
</listitem><listitem><para><olink targetptr="rbactask-40" remap="internal">Using Roles (Task Map)</olink></para>
</listitem><listitem><para><olink targetptr="rbactask-10" remap="internal">Managing RBAC (Task Map)</olink></para>
</listitem>
</itemizedlist><para><indexterm><primary>right</primary><see>rights profiles</see></indexterm>For
an overview of RBAC, see <olink targetptr="rbac-1" remap="internal">Role-Based Access Control
(Overview)</olink>. For reference information, see <olink targetptr="rbacref-1" remap="internal">Chapter&nbsp;10,
Role-Based Access Control (Reference)</olink>. To use privileges with RBAC
or without RBAC, see <olink targetptr="privtask-1" remap="internal">Chapter&nbsp;11, Privileges
(Tasks)</olink>.</para>
</highlights><sect1 id="rbactask-14"><title>Using RBAC (Task Map)</title><indexterm><primary>task maps</primary><secondary>using RBAC</secondary>
</indexterm><indexterm><primary>using</primary><secondary>RBAC task map</secondary>
</indexterm><para>To use RBAC requires planning, configuring RBAC, and knowing how to
assume a role. Once roles become familiar, you might further customize RBAC
to handle new operations. The following task map points to these major tasks.</para><informaltable frame="all" pgwide="1"><tgroup cols="3" colsep="1" rowsep="1"><colspec colname="colspec6" colwidth="25.13*"/><colspec colname="colspec7" colwidth="36.35*"/><colspec colname="colspec8" colwidth="37.52*"/><thead><row><entry><para>Task</para>
</entry><entry><para>Description</para>
</entry><entry><para>For Instructions</para>
</entry>
</row>
</thead><tbody><row><?PubTbl row rht="1.04in"?><entry><para>Plan and configure RBAC </para>
</entry><entry><para>Configure RBAC at your site.</para>
</entry><entry><para><olink targetptr="rbactask-15" remap="internal">Configuring RBAC (Task Map)</olink></para>
</entry>
</row><row><?PubTbl row rht="1.04in"?><entry><para>Use roles</para>
</entry><entry><para>Assume roles from the command line and in the Solaris Management Console
GUI.</para>
</entry><entry><para><olink targetptr="rbactask-40" remap="internal">Using Roles (Task Map)</olink></para>
</entry>
</row><row><?PubTbl row rht="1.04in"?><entry><para>Customize RBAC</para>
</entry><entry><para>Customize RBAC for your site.</para>
</entry><entry><para><olink targetptr="rbactask-10" remap="internal">Managing RBAC (Task Map)</olink></para>
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</sect1><sect1 id="rbactask-15"><title>Configuring RBAC (Task Map)</title><indexterm><primary>task maps</primary><secondary>configuring RBAC</secondary>
</indexterm><indexterm><primary>configuring</primary><secondary>RBAC task map</secondary>
</indexterm><para>To use RBAC effectively requires planning. Use the following task map
to plan and initially implement RBAC at your site.</para><informaltable frame="all" pgwide="1"><tgroup cols="3" colsep="1" rowsep="1"><colspec colname="colspec6" colwidth="25.13*"/><colspec colname="colspec7" colwidth="36.35*"/><colspec colname="colspec8" colwidth="37.52*"/><thead><row><entry><para>Task</para>
</entry><entry><para>Description</para>
</entry><entry><para>For Instructions</para>
</entry>
</row>
</thead><tbody><row><?PubTbl row rht="1.04in"?><entry><para>1. Plan for RBAC </para>
</entry><entry><para>Involves examining your site's security needs, and deciding how to use
RBAC at your site.</para>
</entry><entry><para><olink targetptr="rbactask-16" remap="internal">How to Plan Your RBAC Implementation</olink></para>
</entry>
</row><row><?PubTbl row rht="1.04in"?><entry><para>2. Learn to use the Solaris Management Console</para>
</entry><entry><para>Involves becoming familiar with the Solaris Management Console.</para>
</entry><entry><para><olink targetdoc="group-sa" targetptr="smcover-1" remap="external">Chapter 2, <citetitle remap="chapter">Working With the Solaris Management Console (Tasks),</citetitle> in <citetitle remap="book">System Administration Guide: Basic Administration</citetitle></olink></para>
</entry>
</row><row><?PubTbl row rht="1.04in"?><entry><para>3. Configure the first user and role</para>
</entry><entry><para>Uses the RBAC configuration tools in the Solaris Management Console
to create a user and a role, and to assign the role to the user.</para>
</entry><entry><para><olink targetdoc="group-sa" targetptr="smcover-95" remap="external"><citetitle remap="section">Using the Solaris Management Tools With RBAC (Task Map)</citetitle> in <citetitle remap="book">System Administration Guide: Basic Administration</citetitle></olink></para>
</entry>
</row><row><?PubTbl row rht="1.04in"?><entry><para>4. (Optional) Create other users who can assume roles</para>
</entry><entry><para>Ensures that users who can assume an administrative role exist.</para>
</entry><entry><para><olink targetdoc="group-sa" targetptr="smcover-95" remap="external"><citetitle remap="section">Using the Solaris Management Tools With RBAC (Task Map)</citetitle> in <citetitle remap="book">System Administration Guide: Basic Administration</citetitle></olink></para>
</entry>
</row><row><?PubTbl row rht="1.04in"?><entry morerows="3"><para>5. (Recommended) Create other roles and assign them to users</para>
</entry><entry morerows="1"><para>Uses the RBAC tools to create roles for particular administrative areas,
and to assign the roles to users.</para>
</entry><entry><para><olink targetptr="rbactask-32" remap="internal">How to Create and Assign a Role by Using
the GUI</olink></para>
</entry>
</row><row><?PubTbl row rht="1.04in"?><entry><para><olink targetptr="rbactask-18" remap="internal">Example&nbsp;9&ndash;5</olink></para>
</entry>
</row><row><entry morerows="1"><para>Uses the command line to create roles, and to assign the roles to users</para>
</entry><?PubTbl row rht="1.04in"?><entry><para><olink targetptr="rbactask-22" remap="internal">How to Create a Role From the Command
Line</olink></para>
</entry>
</row><row><?PubTbl row rht="1.04in"?><entry><para><olink targetptr="rbactask-44" remap="internal">How to Assign a Role to a Local User</olink></para>
</entry>
</row><row><entry><para>6. (Recommended) Audit role actions</para>
</entry><entry><para>Preselect an audit class that includes the audit event that records
role actions.</para>
</entry><entry><para><olink targetptr="rbactask-34" remap="internal">How to Audit Roles</olink></para>
</entry>
</row><row><?PubTbl row rht="1.04in"?><entry><para>7. (Optional) Make <literal>root</literal> user a role </para>
</entry><entry><para>Prevents anonymous <literal>root</literal> login, which is a security
hole.</para>
</entry><entry><para><olink targetptr="rbactask-20" remap="internal">How to Make root User Into a Role</olink></para>
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</sect1><sect1 id="rbactask-30"><title>Configuring RBAC</title><indexterm><primary>RBAC</primary><secondary>configuring</secondary>
</indexterm><indexterm><primary>configuring</primary><secondary>RBAC</secondary>
</indexterm><itemizedlist><para>RBAC can be configured with the following utilities:</para><listitem><para><emphasis role="strong">Solaris Management Console GUI &ndash;</emphasis> The
preferred method for performing RBAC-related tasks is through the GUI. The
console tools for managing the RBAC elements are contained in the Users Tool
collection.</para>
</listitem><listitem><para><emphasis role="strong">Solaris Management Console commands &ndash;</emphasis> With the Solaris Management Console command-line interfaces, such
as <command>smrole</command>, you can operate on any name service. The Solaris
Management Console commands require authentication to connect to the server.
As a result, these commands are not practical for use in scripts.</para>
</listitem><listitem><para><emphasis role="strong">Local commands &ndash;</emphasis> With
the <literal>user</literal>* and <literal>role</literal>* set of command-line
interfaces, such as <command>useradd</command>, you can operate on local files
only. The commands that operate on local files must be run by superuser or
by a role with the appropriate privileges.</para>
</listitem>
</itemizedlist><task id="rbactask-16"><title>How to Plan Your RBAC Implementation</title><indexterm><primary>RBAC</primary><secondary>planning</secondary>
</indexterm><indexterm><primary>planning</primary><secondary>RBAC</secondary>
</indexterm><indexterm><primary>configuring</primary><secondary>RBAC</secondary>
</indexterm><indexterm><primary>administering</primary><secondary>roles to replace superuser</secondary>
</indexterm><indexterm><primary>replacing</primary><secondary>superuser with roles</secondary>
</indexterm><tasksummary><para>RBAC can be an integral part of how an organization manages its information
resources. Planning requires a thorough knowledge of the RBAC capabilities
as well as the security requirements of your organization.</para>
</tasksummary><procedure><step><para>Learn the basic RBAC concepts.</para><para>Read <olink targetptr="rbac-1" remap="internal">Role-Based Access Control (Overview)</olink>. Using RBAC
to administer a system is very different from using conventional UNIX administrative
practices. You should be familiar with the RBAC concepts before you start
your implementation. For greater detail, see <olink targetptr="rbacref-1" remap="internal">Chapter&nbsp;10,
Role-Based Access Control (Reference)</olink>.</para>
</step><step><para>Examine your security policy.</para><para>Your organization's
security policy should detail the potential threats to your system, measure
the risk of each threat, and have a strategy to counter these threats. Isolating
the security-relevant tasks through RBAC can be a part of the strategy. Although
you can install the recommended roles and their configurations as is, you
might need to customize your RBAC configuration to adhere to your security
policy.</para>
</step><step><para>Decide how much RBAC your organization needs.</para><itemizedlist><para>Depending on your security needs, you can use varying degrees of RBAC,
as follows:</para><listitem><para><emphasis role="strong">No RBAC &ndash;</emphasis> You can
perform all tasks as <literal>root</literal> user. In this configuration,
you log in as yourself. Then, you type <literal>root</literal> as the user
when you select a Solaris Management Console tool.</para>
</listitem><listitem><para><emphasis role="strong">Single Role Only &ndash;</emphasis> This
method adds one role. The one role is assigned the Primary Administrator rights
profile. This method is similar to the superuser model, in that the role has
superuser capabilities. However, this method enables you to track the user
who has assumed the role.</para>
</listitem><listitem><para><emphasis role="strong">Recommended Roles &ndash;</emphasis> This
method creates three roles that are based on the following rights profiles:
Primary Administrator, System Administrator, and Operator. The roles are suitable
for organizations with administrators at different levels of responsibility.</para>
</listitem><listitem><para><emphasis role="strong">Custom Roles &ndash;</emphasis> You
can create your own roles to meet the security requirements of your organization.
The new roles can be based on existing or customized rights profiles. To customize
rights profiles that enforce separation of duty, see <olink targetdoc="trsoladmproc" targetptr="txconf-14" remap="external"><citetitle remap="section">Creating Roles and Users in Trusted Extensions</citetitle> in <citetitle remap="book">Solaris Trusted Extensions Administrator&rsquo;s Procedures</citetitle></olink>.</para>
</listitem><listitem><para><emphasis role="strong">Root User as a Role &ndash;</emphasis> This
method  prevents any user from logging in as <literal>root</literal>. Instead,
users must log in as ordinary users prior to assuming the <literal>root</literal> role.
For details, see <olink targetptr="rbactask-20" remap="internal">How to Make root User Into
a Role</olink>.</para>
</listitem>
</itemizedlist>
</step><step><para>Decide which recommended roles are appropriate for your organization.</para><para>Review the capabilities of the recommended roles and default
rights profiles. Default rights profiles enable administrators to configure
a recommended role by using a single profile.</para><itemizedlist><para>Three default rights profiles are available for configuring the recommended
roles:</para><listitem><para><emphasis role="strong">Primary Administrator rights profile &ndash;</emphasis> For configuring a role that can perform all administrative tasks,
can grant rights to others, and can edit rights that are associated with administrative
roles. A user in this role can assign this role to other users, and can grant
rights to other users.</para>
</listitem><listitem><para><emphasis role="strong">System Administrator rights profile &ndash;</emphasis> For configuring a role that can perform most administrative tasks
that are not related to security. For example, the System Administrator can
add new user accounts, but cannot set passwords or grant rights to other users.</para>
</listitem><listitem><para><emphasis role="strong">Operator rights profile &ndash;</emphasis> For
configuring a role that can perform simple administrative tasks, such as media
backup and printer maintenance.</para>
</listitem>
</itemizedlist><itemizedlist><para>To further examine rights profiles, read one of the following:</para><listitem><para>In the <filename class="directory">/etc/security</filename> directory,
read the contents of the <filename>prof_attr</filename> database and the <filename>exec_attr</filename> database.</para>
</listitem><listitem><para>In the Solaris Management Console, use the Rights tool to
display the contents of a rights profile.</para>
</listitem><listitem><para>In this book, refer to <olink targetptr="rbacref-26" remap="internal">Contents
of Rights Profiles</olink> for summaries of some typical rights profiles.</para>
</listitem>
</itemizedlist>
</step><step><para>Decide if any additional roles or rights profiles are appropriate
for your organization.</para><para>Look for other applications or families
of applications at your site that might benefit from restricted access. Applications
that affect security, that can cause denial-of-service problems, or that require
special administrator training are good candidates for RBAC. You can customize
roles and rights profiles to handle the security requirements of your organization.</para><substeps><step><para>Determine which commands are needed for the new task.</para>
</step><step><para>Decide which rights profile is appropriate for this task.</para><para>Check if an existing rights profile can handle this task or if a separate
rights profile needs to be created.</para>
</step><step><para>Determine which role is appropriate for this rights profile.</para><para>Decide if the rights profile for this task should be assigned to an
existing role or if a new role should be created. If you use an existing role,
check that the other rights profiles are appropriate for users who are assigned
to this role.</para>
</step>
</substeps>
</step><step><para>Decide which users should be assigned to the available roles.</para><para>According to the principle of least privilege, you should assign users
to roles that are appropriate to their level of trust. When you prevent users
from access to tasks that the users do not need to perform, you reduce potential
problems.</para>
</step>
</procedure>
</task><task id="rbactask-32"><title>How to Create and Assign a Role by
Using the GUI</title><indexterm><primary>rights profiles</primary><secondary>creating roles for</secondary>
</indexterm><indexterm><primary>roles</primary><secondary>creating</secondary><tertiary>for particular profiles</tertiary>
</indexterm><indexterm><primary>administering</primary><secondary>roles</secondary>
</indexterm><indexterm><primary>RBAC</primary><secondary>adding roles</secondary>
</indexterm><indexterm><primary>roles</primary><secondary>adding for particular profiles</secondary>
</indexterm><indexterm><primary>configuring</primary><secondary>roles</secondary>
</indexterm><indexterm><primary>creating</primary><secondary>roles</secondary><tertiary>for particular profiles</tertiary>
</indexterm><indexterm><primary>adding</primary><secondary>roles</secondary><tertiary>for particular profiles</tertiary>
</indexterm><tasksummary><para>To create a new role, you can be superuser, or you can use the Primary
Administrator role. In this procedure, the creator of the new role has assumed
the role of Primary Administrator.</para>
</tasksummary><taskprerequisites><itemizedlist><listitem><para>You have already created users who can assume a role at your
site. If the users are not yet created, create them by following the instructions
in <olink targetdoc="group-sa" targetptr="usersetup-21" remap="external"><citetitle remap="section">How to Add a User With the Solaris Management Console&rsquo;s Users Tool</citetitle> in <citetitle remap="book">System Administration Guide: Basic Administration</citetitle></olink><olink targetdoc="group-sa" targetptr="smcover-95" remap="external"><citetitle remap="section">Using the Solaris Management Tools With RBAC (Task Map)</citetitle> in <citetitle remap="book">System Administration Guide: Basic Administration</citetitle></olink>.</para>
</listitem><listitem><para>You have been assigned the Primary Administrator role by following
the procedures in <olink targetdoc="group-sa" targetptr="smcover-95" remap="external"><citetitle remap="section">Using the Solaris Management Tools With RBAC (Task Map)</citetitle> in <citetitle remap="book">System Administration Guide: Basic Administration</citetitle></olink>.</para>
</listitem>
</itemizedlist>
</taskprerequisites><procedure><step><para>Start the Solaris Management Console.</para><screen># <userinput>/usr/sbin/smc &amp;</userinput></screen><para>For login instructions, see <olink targetptr="rbactask-21" remap="internal">How to Assume
a Role in the Solaris Management Console</olink>.</para>
</step><step><para>Click the Administrative Roles icon.</para>
</step><step><para>Select Add Administrative Role from the Action menu.</para>
</step><step><para>Create a new role by filling in the fields in the series of dialog
boxes.</para><para>For possible roles, see <olink targetptr="rbactask-35" remap="internal">Example&nbsp;9&ndash;1</olink> to <olink targetptr="rbactask-41" remap="internal">Example&nbsp;9&ndash;4</olink>.</para><tip><para>All tools in the Solaris Management Console display information
in the bottom section of the page or at the left side of a wizard panel. Choose
Help at any time to find additional information about performing tasks in
this interface.</para>
</tip>
</step><step><para><indexterm><primary>assigning</primary><secondary>role to a user</secondary></indexterm>Assign the role to a user.</para><tip><para>After filling in the properties of the role, the last dialog box
prompts you for a user for the role.</para>
</tip>
</step><step><para><indexterm><primary>daemons</primary><secondary><command>nscd</command> (name service cache daemon)</secondary></indexterm><indexterm><primary><command>nscd</command> (name service cache daemon)</primary><secondary>starting with <command>svcadm</command> command</secondary></indexterm><indexterm><primary><command>svcadm</command> command</primary><secondary>restarting name service</secondary></indexterm>In a terminal window,
restart the name service cache daemon.</para><screen># <userinput>svcadm restart system/name-service-cache</userinput></screen><para>For more information, see the <olink targetdoc="group-refman" targetptr="svcadm-1m" remap="external"><citerefentry><refentrytitle>svcadm</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink> and <olink targetdoc="group-refman" targetptr="nscd-1m" remap="external"><citerefentry><refentrytitle>nscd</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink> man pages.</para>
</step>
</procedure><example id="rbactask-35"><title>Creating a Role for the System Administrator Rights Profile</title><indexterm><primary>System Administrator (RBAC)</primary><secondary>creating role</secondary>
</indexterm><indexterm><primary>adding</primary><secondary>System Administrator role</secondary>
</indexterm><indexterm><primary>creating</primary><secondary>System Administrator role</secondary>
</indexterm><indexterm><primary>roles</primary><secondary>creating</secondary><tertiary>System Administrator role</tertiary>
</indexterm><itemizedlist><para>In this example, the new role can do system administration tasks that
are not connected to security. The role is created by performing the preceding
procedure with the following parameters:</para><listitem><para>Role name: <literal>sysadmin</literal></para>
</listitem><listitem><para>Role full name: <literal>System Administrator</literal></para>
</listitem><listitem><para>Role description: <literal>Performs non-security admin tasks</literal></para>
</listitem><listitem><para>Rights profile: <literal>System Administrator</literal></para><para>This rights profile is at the top of the list of profiles that are included
in the role.</para>
</listitem>
</itemizedlist>
</example><example id="rbactask-37"><title>Creating a Role for the Operator Rights Profile</title><indexterm><primary>Operator (RBAC)</primary><secondary>creating role</secondary>
</indexterm><indexterm><primary>adding</primary><secondary>Operator role</secondary>
</indexterm><indexterm><primary>creating</primary><secondary>Operator role</secondary>
</indexterm><indexterm><primary>roles</primary><secondary>creating</secondary><tertiary>Operator role</tertiary>
</indexterm><itemizedlist><para>The Operator rights profile can manage printers and back up the system
to offline media. You might want to assign the role to one user on each shift.
To do so, you would select the role mailing list option in the Step 1: Enter
a Role Name dialog box. The role is created by performing the preceding procedure
with the following parameters:</para><listitem><para>Role name: <literal>operadm</literal></para>
</listitem><listitem><para>Role full name: <literal>Operator</literal></para>
</listitem><listitem><para>Role description: <literal>Backup operator</literal></para>
</listitem><listitem><para>Rights profile: <literal>Operator</literal></para><para>This
rights profile must be at the top of the list of profiles that are included
in the role.</para>
</listitem>
</itemizedlist>
</example><example id="rbactask-39"><title>Creating a Role for a Security-Related Rights Profile</title><indexterm><primary>roles</primary><secondary>creating</secondary><tertiary>security-related roles</tertiary>
</indexterm><indexterm><primary>adding</primary><secondary>security-related roles</secondary>
</indexterm><indexterm><primary>creating</primary><secondary>security-related roles</secondary>
</indexterm><para>By default, the only rights profile that contains security-related commands
and rights is the Primary Administrator profile. If you want to create a role
that is not as powerful as Primary Administrator, but can handle some security-related
tasks, you must create the role.</para><itemizedlist><para>In the following example, the role protects devices. The role is created
by performing the preceding procedure with the following parameters:</para><listitem><para><indexterm><primary>roles</primary><secondary>creating</secondary><tertiary>Device Security role</tertiary></indexterm><indexterm><primary>Device Security (RBAC)</primary><secondary>creating role</secondary></indexterm>Role
name: <literal>devicesec</literal></para>
</listitem><listitem><para>Role full name: <literal>Device Security</literal></para>
</listitem><listitem><para>Role description: <literal>Configures Devices</literal></para>
</listitem><listitem><para>Rights profile: <literal>Device Security</literal></para>
</listitem>
</itemizedlist><itemizedlist><para>In the following example, the role secures systems and hosts on the
network. The role is created by performing the preceding procedure with the
following parameters:</para><listitem><para><indexterm><primary>roles</primary><secondary>creating</secondary><tertiary>Network Security role</tertiary></indexterm><indexterm><primary>Network Security (RBAC)</primary><secondary>creating role</secondary></indexterm>Role
name: <literal>netsec</literal></para>
</listitem><listitem><para>Role full name: <literal>Network Security</literal></para>
</listitem><listitem><para>Role description: <literal>Handles IPsec, IKE, and SSH</literal></para>
</listitem><listitem><para>Rights profile: <literal>Network Security</literal></para>
</listitem>
</itemizedlist>
</example><example id="rbactask-41"><title>Creating a Role for a Rights Profile With Limited Scope</title><indexterm><primary>roles</primary><secondary>creating</secondary><tertiary>role with limited scope</tertiary>
</indexterm><indexterm><primary>adding</primary><secondary>roles</secondary><tertiary>with limited scope</tertiary>
</indexterm><indexterm><primary>creating</primary><secondary>roles</secondary><tertiary>with limited scope</tertiary>
</indexterm><indexterm><primary>roles</primary><secondary>creating</secondary><tertiary>DHCP Management role</tertiary>
</indexterm><indexterm><primary>DHCP Management (RBAC)</primary><secondary>creating role</secondary>
</indexterm><itemizedlist><para>A number of rights profiles are of limited scope. In this example, the
sole task of the role is to manage DHCP. The role is created by performing
the preceding procedure with the following parameters:</para><listitem><para>Role name: <literal>dhcpmgt</literal></para>
</listitem><listitem><para>Role full name: <literal>DHCP Management</literal></para>
</listitem><listitem><para>Role description: <literal>Manages Dynamic Host Config Protocol</literal></para>
</listitem><listitem><para>Rights profile: <literal>DHCP Management</literal></para>
</listitem>
</itemizedlist>
</example><example id="rbactask-18"><title>Modifying a User's Role Assignment</title><indexterm><primary>roles</primary><secondary>modifying assignment to a user</secondary>
</indexterm><indexterm><primary>adding</primary><secondary>roles</secondary><tertiary>to a user</tertiary>
</indexterm><indexterm><primary>modifying</primary><secondary>role assignment to a user</secondary>
</indexterm><indexterm><primary>assigning</primary><secondary>role to a user</secondary>
</indexterm><para>In this example, a role is added to an existing user. The user's role
assignment is modified by clicking the User Accounts icon in the Users tool
in the Solaris Management Console, double-clicking the user, and following
the online help to add a role to the user's capabilities.</para>
</example><taskrelated role="troubleshooting"><itemizedlist><para><indexterm><primary>roles</primary><secondary>troubleshooting</secondary></indexterm><indexterm><primary>troubleshooting</primary><secondary>role capabilities</secondary></indexterm>Check the following if the role does not have the
capabilities that it should:</para><listitem><para>Are the role's rights profiles listed in the GUI from most
to least powerful?</para><para>For example, if the <literal>All</literal> rights
profile is at the top of the list, then no commands are run with security
attributes. A profile that contains commands with security attributes must
precede the <literal>All</literal> rights profile in the list.</para>
</listitem><listitem><para>Do the commands in the role's rights profiles have the appropriate
security attributes?</para><para>For example, when the policy is <literal>suser</literal>,
some commands require <literal>uid=0</literal> rather than <literal>euid=0</literal>.</para>
</listitem><listitem><para>Is the rights profile defined in the appropriate name service
scope? Is the role operating in the name service scope where the rights profile
is defined?</para>
</listitem><listitem><para>Has the name service cache, <literal>svc:/system/name-service-cache</literal>, been restarted?</para><para>The <command>nscd</command> daemon
can have a lengthy time-to-live interval. By restarting the daemon, you update
the name service with current data.</para>
</listitem>
</itemizedlist>
</taskrelated>
</task><task id="rbactask-22"><title>How to Create a Role From the Command
Line</title><indexterm><primary>roles</primary><secondary>creating</secondary><tertiary>on command line</tertiary>
</indexterm><indexterm><primary>adding</primary><secondary>roles</secondary><tertiary>from command line</tertiary>
</indexterm><indexterm><primary>creating</primary><secondary>roles</secondary><tertiary>on command line</tertiary>
</indexterm><indexterm><primary>configuring</primary><secondary>roles</secondary><tertiary>from command line</tertiary>
</indexterm><indexterm><primary>RBAC</primary><secondary>adding roles from command line</secondary>
</indexterm><indexterm><primary>roles</primary><secondary>adding from command line</secondary>
</indexterm><tasksummary><para>The Solaris Management Console GUI is the preferred method for managing
RBAC. To use the GUI, see <olink targetptr="rbactask-32" remap="internal">How to Create and
Assign a Role by Using the GUI</olink>. You can also use the command-line
interfaces, as described in this procedure.</para><note><para>Do not attempt to administer RBAC with the command line and the
graphical user interface at the same time. Conflicting changes could be made
to the configuration, and the behavior would be unpredictable. You can use
both tools to administer RBAC, but you cannot use both concurrently.</para>
</note>
</tasksummary><taskprerequisites><para>To create a role, you must either assume a role that includes the Primary
Administrator rights profile, or switch to the user <literal>root</literal>.</para>
</taskprerequisites><procedure>&rolePAstep;<step><para>Choose one of the following commands to create a role on the command
line.</para><stepalternatives><step><para><indexterm><primary><command>roleadd</command> command</primary><secondary>using</secondary></indexterm>For roles in the local name service
scope, use the <command>roleadd</command> command.</para><note><para>The <command>roleadd</command> command is more limited than the
Solaris Management Console GUI or command-line interfaces. After running the <command>roleadd</command> command, you must run the <command>usermod</command> command
to assign the role to a user. And, the user then must set the password for
the role, as shown in <olink targetptr="rbactask-44" remap="internal">How to Assign a Role
to a Local User</olink>.</para>
</note><screen># roleadd -c <replaceable>comment</replaceable> \
-g <replaceable>group</replaceable> -m <replaceable>homedir</replaceable> -u <replaceable>UID</replaceable> -s <replaceable>shell</replaceable> \
-P <replaceable>profile</replaceable> <replaceable>rolename</replaceable></screen><variablelist><varlistentry><term><option>c</option> <replaceable>comment</replaceable></term><listitem><para>Is a comment that describes <replaceable>rolename</replaceable>.</para>
</listitem>
</varlistentry><varlistentry><term><option>g</option> <replaceable>group</replaceable></term><listitem><para>Is the group assignment for <replaceable>rolename</replaceable>.</para>
</listitem>
</varlistentry><varlistentry><term><option>m</option> <replaceable>homedir</replaceable></term><listitem><para>Is the path to the home directory for <replaceable>rolename</replaceable>.</para>
</listitem>
</varlistentry><varlistentry><term><option>u</option> <replaceable>UID</replaceable></term><listitem><para>Is the UID for <replaceable>rolename</replaceable>.</para>
</listitem>
</varlistentry><varlistentry><term><option>s</option> <replaceable>shell</replaceable></term><listitem><para>Is the login shell for <replaceable>rolename</replaceable>.
This shell must be a profile shell.</para>
</listitem>
</varlistentry><varlistentry><term><option>P</option> <replaceable>profile</replaceable></term><listitem><para>Is one or more rights profiles for <replaceable>rolename</replaceable>.</para>
</listitem>
</varlistentry><varlistentry><term><replaceable>rolename</replaceable></term><listitem><para>Is the name of the new local role.</para>
</listitem>
</varlistentry>
</variablelist>
</step><step><para>Use the <command>smrole add</command> command.</para><para>This
command creates a role in a distributed name service, such as NIS, NIS+, or
LDAP. This command runs as a client of the Solaris Management Console server.</para><screen>$ /usr/sadm/bin/smrole -D <replaceable>domain-name</replaceable> \ 
-r <replaceable>admin-role</replaceable> -l <replaceable>&lt;Type admin-role password&gt;</replaceable> \
add -- -n <replaceable>rolename</replaceable> -a <replaceable>rolename</replaceable> -d <replaceable>directory</replaceable>\
-F <replaceable>full-description</replaceable> -p <replaceable>profile</replaceable></screen><variablelist><varlistentry><term><option>D</option> <replaceable>domain-name</replaceable></term><listitem><para>Is the name of the domain that you want to manage.</para>
</listitem>
</varlistentry><varlistentry><term><option>r</option> <replaceable>admin-role</replaceable></term><listitem><para>Is the name of the administrative role that can modify the
role. The administrative role must have the <literal>solaris.role.assign</literal> authorization.
If you are modifying a role that you have assumed, the role must have the <literal>solaris.role.delegate</literal> authorization.</para>
</listitem>
</varlistentry><varlistentry><term><option>l</option></term><listitem><para>Is the prompt for the password of <replaceable>admin-role</replaceable>.</para>
</listitem>
</varlistentry><varlistentry><term><literal>--</literal></term><listitem><para>Is the required separator between authentication options and
subcommand options.</para>
</listitem>
</varlistentry><varlistentry><term><option>n</option> <replaceable>rolename</replaceable></term><listitem><para>Is the name of the new role.</para>
</listitem>
</varlistentry><varlistentry><term><option>c</option> <replaceable>comment</replaceable></term><listitem><para>Is the comment that describes the capabilities of the role.</para>
</listitem>
</varlistentry><varlistentry><term><option>a</option> <replaceable>username</replaceable></term><listitem><para>Is the name of the user who can assume <replaceable>rolename</replaceable>.</para>
</listitem>
</varlistentry><varlistentry><term><option>d</option> <replaceable>directory</replaceable></term><listitem><para>Is the home directory for <replaceable>rolename</replaceable>.</para>
</listitem>
</varlistentry><varlistentry><term><option>F</option> <replaceable>full-description</replaceable></term><listitem><para>Is the full description for <replaceable>rolename</replaceable>.
This description is displayed in the Solaris Management Console GUI.</para>
</listitem>
</varlistentry><varlistentry><term><option>p</option> <replaceable>profile</replaceable></term><listitem><para>Is a rights profile that is included in the capabilities of <replaceable>rolename</replaceable>. This option gives commands with administrative capabilities
to the role. You can specify multiple <option>p</option> <replaceable>profile</replaceable> options.</para>
</listitem>
</varlistentry>
</variablelist>
</step>
</stepalternatives>
</step><step><para>To put the changes into effect, see <olink targetptr="rbactask-44" remap="internal">How
to Assign a Role to a Local User</olink>.</para>
</step>
</procedure><example id="rbactask-19"><title>Creating a Custom Operator Role by Using the <command>smrole</command> Command</title><indexterm><primary>roles</primary><secondary>creating</secondary><tertiary>Custom Operator role</tertiary>
</indexterm><indexterm><primary><command>smrole</command> command</primary><secondary>using</secondary>
</indexterm><indexterm><primary>adding</primary><secondary>customized role</secondary>
</indexterm><indexterm><primary>creating</primary><secondary>customized role</secondary>
</indexterm><indexterm><primary>Custom Operator (RBAC)</primary><secondary>creating role</secondary>
</indexterm><indexterm><primary>RBAC</primary><secondary>adding custom roles</secondary>
</indexterm><indexterm><primary>adding</primary><secondary>custom roles (RBAC)</secondary>
</indexterm><indexterm><primary>roles</primary><secondary>adding custom roles</secondary>
</indexterm><indexterm><primary>configuring</primary><secondary>custom roles</secondary>
</indexterm><indexterm><primary><option>a</option> option</primary><secondary><command>smrole</command> command</secondary>
</indexterm><para>The <command>smrole</command> command specifies a new role and its attributes
in a name service. In the following example, the Primary Administrator creates
a new version of the Operator role. The role includes the standard Operator
rights profile as well as the Media Restore rights profile. Note that the
command prompts you for a password for the new role.</para><screen>% <userinput>su - primaryadm</userinput>
Password: <lineannotation>&lt;Type primaryadm password&gt;</lineannotation> 
$ <userinput>/usr/sadm/bin/smrole add -H myHost -- -c "Backup and Restore Operator" \</userinput>
<userinput>-n operadm2 -a janedoe -d /export/home/operadm \</userinput>
<userinput>-F "Backup/Restore Operator" -p "Operator" -p "Media Restore"</userinput>
Authenticating as user: primaryadm

Type /? for help, pressing &lt;enter&gt; accepts the default denoted by [ ]
Please enter a string value for: password :: <lineannotation>&lt;Type primaryadm password&gt;</lineannotation>

Loading Tool: com.sun.admin.usermgr.cli.role.UserMgrRoleCli from myHost
Login to myHost as user primaryadm was successful.
Download of com.sun.admin.usermgr.cli.role.UserMgrRoleCli from myHost was successful.

Type /? for help, pressing &lt;enter&gt; accepts the default denoted by [ ]
Please enter a string value for: password ::<lineannotation>&lt;Type operadm2 password&gt;</lineannotation>

$ <userinput>svcadm restart system/name-service-cache</userinput></screen><para>The <command>smrole</command> command with the <command>list</command> subcommand
is used to display the new role:</para><screen>$ <userinput>/usr/sadm/bin/smrole list --</userinput>
Authenticating as user: primaryadm

Type /? for help, pressing &lt;enter&gt; accepts the default denoted by [ ]
Please enter a string value for: password :: <lineannotation>&lt;Type  primaryadm password&gt;</lineannotation>

Loading Tool: com.sun.admin.usermgr.cli.role.UserMgrRoleCli from myHost
Login to myHost as user primaryadm was successful.
Download of com.sun.admin.usermgr.cli.role.UserMgrRoleCli from myHost was successful.
root                    0             Superuser
primaryadm            100             Most powerful role
sysadmin              101             Performs non-security admin tasks
operadm               102             Backup Operator
operadm2              103             Backup/Restore Operator</screen>
</example>
</task><task id="rbactask-44"><title>How to Assign a Role to a Local User</title><indexterm><primary>roles</primary><secondary>assigning with <command>usermod</command> command</secondary>
</indexterm><indexterm><primary><command>usermod</command> command</primary><secondary>using to assign role</secondary>
</indexterm><indexterm><primary>assigning</primary><secondary>role to a user locally</secondary>
</indexterm><tasksummary><para>This procedure assigns a local role to a local user, restarts the name
cache daemon, and then shows how the user can assume the role.</para><para>To assign a role to a user in a distributed name service, see <olink targetptr="rbactask-22" remap="internal">How to Create a Role From the Command Line</olink> and <olink targetptr="rbactask-23" remap="internal">How to Change the Properties of a Role</olink>.</para>
</tasksummary><taskprerequisites><para>You have added a local role, as described in <olink targetptr="rbactask-22" remap="internal">How to Create a Role From the Command Line</olink>. You must have assumed
the role of Primary Administrator or have switched to superuser.</para>
</taskprerequisites><procedure><step><para>Assign the role to a local user.</para><para>If you added a local
role with the <command>roleadd</command> command, this step is required. This
step is optional when you use the <command>smrole</command> command and the
Solaris Management Console to create a role.</para><screen># usermod -u <replaceable>UID</replaceable> -R <replaceable>rolename</replaceable></screen><variablelist><varlistentry><term><option>u</option> <replaceable>UID</replaceable></term><listitem><para>Is the UID of the user.</para>
</listitem>
</varlistentry><varlistentry><term><option>R</option> <replaceable>rolename</replaceable></term><listitem><para>Is the role that is being assigned to the user.</para>
</listitem>
</varlistentry>
</variablelist>
</step><step><para>To put the changes into effect, restart the name service cache
daemon.</para><screen># svcadm restart system/name-service-cache</screen><para>If you added a role with a Solaris Management Console interface, go
to <olink targetptr="rbactask-40" remap="internal">Using Roles (Task Map)</olink>. Otherwise,
continue with the next step.</para>
</step><step performance="optional"><para>To unlock the role account, the user must
create a password.</para><para>If you added a local role with the <command>roleadd</command> command, this step is required.</para><screen>% su - <replaceable>rolename</replaceable>
Password: <lineannotation>&lt;Type rolename password&gt;</lineannotation>
Confirm Password: <lineannotation>&lt;Retype rolename password&gt;</lineannotation>
$</screen>
</step>
</procedure><example id="rbactask-17"><title>Creating and Assigning a Local Role From the Command Line</title><indexterm><primary>roles</primary><secondary>creating</secondary><tertiary>Crypto Management role</tertiary>
</indexterm><indexterm><primary>adding</primary><secondary>cryptomgt role</secondary>
</indexterm><indexterm><primary>adding</primary><secondary>security-related role</secondary>
</indexterm><indexterm><primary>Crypto Management (RBAC)</primary><secondary>creating role</secondary>
</indexterm><indexterm><primary>cryptographic framework</primary><secondary>administering with role</secondary>
</indexterm><para>In this example, a role is created to administer the Solaris Cryptographic
Framework. The Crypto Management rights profile contains the <command>cryptoadm</command> command
for administering hardware and software cryptographic services on a local
system.</para><screen># <userinput>roleadd -c "Cryptographic Services manager" \</userinput>
<userinput>-g 14 -m /export/home/cryptoadm -u 104 -s pfksh \</userinput>
<userinput>-P "Crypto Management" cryptomgt</userinput>
# <userinput>usermod -u 1111 -R cryptomgt</userinput>
# <userinput>svcadm restart system/name-service-cache</userinput>
% <userinput>su - cryptomgt</userinput>
Password: <lineannotation>&lt;Type cryptomgt password&gt;</lineannotation>
Confirm Password: <lineannotation>&lt;Retype cryptomgt password&gt;</lineannotation>
$ <userinput>/usr/ucb/whoami</userinput>
cryptomgt
$</screen><para>For information about the Solaris Cryptographic Framework, see <olink targetptr="scf-1" remap="internal">Chapter&nbsp;13, Solaris Cryptographic Framework (Overview)</olink>.
To administer the framework, see <olink targetptr="scftask-28" remap="internal">Administering
the Cryptographic Framework (Task Map)</olink>.</para>
</example>
</task><task id="rbactask-34"><title>How to Audit Roles</title><indexterm><primary>roles</primary><secondary>auditing</secondary>
</indexterm><indexterm><primary>auditing</primary><secondary>roles</secondary>
</indexterm><indexterm><primary>adding</primary><secondary>auditing of roles</secondary>
</indexterm><indexterm><primary>RBAC</primary><secondary>auditing roles</secondary>
</indexterm><indexterm><primary>monitoring</primary><secondary>use of privileged commands</secondary>
</indexterm><tasksummary><para>The actions that a role performs can be audited. Included in the audit
record is the login name of the user who assumed the role, the role name,
and the action that the role performed.  The <literal>6180:AUE_prof_cmd:profile
command:ua,as</literal> audit event collects the information. By preselecting
the <literal>as</literal> class or the <literal>ua</literal> class, you can
audit role actions.</para>
</tasksummary><procedure><step><para>Plan for auditing and edit the audit configuration files.</para><para>For more information, see <olink targetptr="audittask-3" remap="internal">Solaris Auditing
(Task Map)</olink>.</para>
</step><step><para>Include the <literal>ua</literal> class or the <literal>as</literal> class
in the <literal>flags</literal> line of the <filename>audit_control</filename> file.</para><screen># audit_control file
dir:/var/audit
flags:lo,<userinput>as</userinput>
minfree:20
naflags:lo</screen><para>The <literal>ua</literal> class and the <literal>as</literal> class
include other audit events. To see the audit events that are included in a
class, read the <filename>audit_event</filename> file. You can also use the <command>bsmrecord</command> command, as shown in <olink targetptr="audittask-33" remap="internal">Example&nbsp;30&ndash;25</olink>.</para>
</step><step><para>Finish configuring the auditing service, then enable auditing.</para><para>For more information, see <olink targetptr="audittask-28" remap="internal">Configuring
and Enabling the Auditing Service (Tasks)</olink>.</para>
</step>
</procedure>
</task><task id="rbactask-20"><title>How to Make <literal>root</literal> User
Into a Role</title><indexterm><primary>roles</primary><secondary>making <literal>root</literal> user into role</secondary>
</indexterm><indexterm><primary>roles</primary><secondary>creating</secondary><tertiary><literal>root</literal> role</tertiary>
</indexterm><indexterm><primary><literal>root</literal> user</primary><secondary>changing to <literal>root</literal> role</secondary>
</indexterm><indexterm><primary>access</primary><secondary><literal>root</literal> access</secondary><tertiary>preventing login (RBAC)</tertiary>
</indexterm><indexterm><primary>configuring</primary><secondary><literal>root</literal> user as role</secondary>
</indexterm><indexterm><primary>creating</primary><secondary><literal>root</literal> user as role</secondary>
</indexterm><indexterm><primary>changing</primary><secondary><literal>root</literal> user into role</secondary>
</indexterm><tasksummary><para>This procedure shows how to change <literal>root</literal> from a login
user to a role. When you complete this procedure, you can no longer directly
log in to the system as <literal>root</literal>, except in single-user mode.
You must be assigned the <literal>root</literal> role and <command>su</command> to <literal>root</literal>.</para><para>By changing the <literal>root</literal> user into a role, you prevent
anonymous <literal>root</literal> login. Because a user must log in and <emphasis>then</emphasis> assume the <literal>root</literal> role, the user's login
ID is provided to the auditing service and is in the <filename>sulog</filename> file.</para><para>In this procedure, you create a local user and assign the <literal>root</literal> role
to the user. To prevent users from assuming the role, see <olink targetptr="rbactask-59" remap="internal">Example&nbsp;9&ndash;8</olink>.</para>
</tasksummary><procedure><step><para>As a regular user, log in to the target system.</para>
</step><step><para>Assume the Primary Administrator role, or become superuser.</para><para>The Primary Administrator role includes the Primary Administrator profile.
To create the role and assign the role to a user, see <olink targetdoc="group-sa" targetptr="smcover-95" remap="external"><citetitle remap="section">Using the Solaris Management Tools With RBAC (Task Map)</citetitle> in <citetitle remap="book">System Administration Guide: Basic Administration</citetitle></olink>.</para>
</step><step><para><indexterm><primary><command>useradd</command> command</primary><secondary>adding local user</secondary></indexterm><indexterm><primary>adding</primary><secondary>local user</secondary></indexterm><indexterm><primary>creating</primary><secondary>local user</secondary></indexterm><indexterm><primary>users</primary><secondary>adding local user</secondary></indexterm><indexterm><primary>users</primary><secondary>creating local user</secondary></indexterm>Create a local user
who can assume the <literal>root</literal> role.</para><para>For safety, at
least one local user should be assigned the <literal>root</literal> role.</para><screen>$ useradd -c <replaceable>comment</replaceable> -u <replaceable>uid</replaceable> -d <replaceable>homedir username</replaceable></screen><variablelist><varlistentry><term><option>c</option> <replaceable>comment</replaceable></term><listitem><para>Is the comment that describes the user.</para>
</listitem>
</varlistentry><varlistentry><term><option>d</option> <replaceable>homedir</replaceable></term><listitem><para>Is the home directory of the user. This directory should be
on the local system.</para>
</listitem>
</varlistentry><varlistentry><term><option>u</option> <replaceable>uid</replaceable></term><listitem><para>Is the user identification number.</para>
</listitem>
</varlistentry><varlistentry><term><replaceable>username</replaceable></term><listitem><para>Is the name of the new local user.</para>
</listitem>
</varlistentry>
</variablelist><screen># <userinput>useradd -c "JDoe's local account" -u 123 -d /export/home1 jdoe-local</userinput></screen>
</step><step><para>Give the user a password.</para><screen># <userinput>passwd -r files jdoe-local</userinput>
New Password:    <lineannotation>&lt;Type password&gt;</lineannotation>
Re-enter new Password: <lineannotation>&lt;Retype password&gt;</lineannotation>
passwd: password successfully changed for jdoe-local
#</screen>
</step><step><para>Make sure that you are not logged in as <literal>root</literal>.</para><screen># <userinput>who</userinput>
jdoe    console      May 24 13:51    (:0)
jdoe    pts/5        May 24 13:51    (:0.0)
jdoe    pts/4        May 24 13:51    (:0.0)
jdoe    pts/10       May 24 13:51    (:0.0)</screen>
</step><step><para>Change <literal>root</literal> user into a role.</para><screen># <userinput>usermod -K type=role root</userinput></screen>
</step><step><para>Verify that <literal>root</literal> is a role.</para><para>The <literal>root</literal> entry in the <filename>user_attr</filename> file should appear
similar to the following:</para><screen># <userinput>grep root /etc/user_attr</userinput>
root::::type=role;auths=solaris.*,solaris.grant;profiles=...</screen>
</step><step><para>Assign the <literal>root</literal> role to your local account.</para><screen># <userinput>usermod -R root jdoe-local</userinput></screen><caution><para>If you do not assign the <literal>root</literal> role to a
user, no one can become superuser, except in single-user mode. You must type
a root password to enter single-user mode.</para>
</caution>
</step><step><para>Configure the name service to return in case of failure.</para><substeps><step><para>Open a new terminal window and assume the <literal>root</literal> role.</para><screen>% <userinput>whoami</userinput>
jdoe
% <userinput>su - jdoe-local</userinput>
Enter password:   <lineannotation>&lt;Type jdoe-local password&gt;</lineannotation>
% <userinput>roles</userinput>
root
% <userinput>su - root</userinput>
Enter password:   <lineannotation>&lt;Type root password&gt;</lineannotation>
#</screen>
</step><step><para>Edit the <filename>nsswitch.conf</filename> file.</para><para><indexterm><primary>configuring</primary><secondary>name service</secondary></indexterm>For
example, the following entries in the <filename>nsswitch.conf</filename> file
would enable the name service to return.</para><screen>passwd:  files nis [TRYAGAIN=0 UNAVAIL=return NOTFOUND=return]
group:  files nis [TRYAGAIN=0 UNAVAIL=return NOTFOUND=return]</screen>
</step>
</substeps>
</step><step performance="optional"><para>Assign the <literal>root</literal> role
to selected user accounts in the name service.</para><para>For the procedure,
see <olink targetptr="rbactask-25" remap="internal">How to Change the RBAC Properties of a
User</olink>.</para>
</step>
</procedure><example id="rbactask-59"><title>Preventing the <literal>root</literal> Role From Being Used to Configure
a System</title><para>In this example, site security policy requires that several discrete
roles configure the system. These discrete roles have been created and tested.
To prevent the <literal>root</literal> account from being used to configure
the system, the security administrator changes <literal>root</literal> into
a role, but does not assign the role. The <literal>root</literal> role retains
a password to enter the system in single-user mode.</para><para>First, the administrator verifies that <literal>root</literal> is not
an assigned role.</para><screen>% <userinput>whoami</userinput>
jdoe-local
% <userinput>su - root</userinput>
Password: <userinput>a!2@3#4$5%6^7</userinput>
# <userinput>grep roles /etc/user_attr</userinput>
jdoe-local::::type=normal;roles=secadmin
kdoe-local::::type=normal;roles=sysadmin</screen><para>Still in the <literal>root</literal> account, the administrator changes <literal>root</literal> into a role.</para><screen># <userinput>usermod -K type=role root</userinput></screen><para>Then, the administrator verifies the change in the <literal>root</literal> entry
in the <filename>user_attr</filename> file.</para><screen># <userinput>grep root /etc/user_attr</userinput>
root::::type=<emphasis>role</emphasis>;auths=solaris.*,solaris.grant;profiles=...</screen>
</example><example id="rbactask-58"><title>Changing the <literal>root</literal> Role Back Into the <literal>root</literal> User</title><para>In this example, the administrator is decommissioning a system and wants
to log in to the desktop as superuser. The system has been removed from the
network.</para><para>First, the administrator assumes the <literal>root</literal> role to
remove all <literal>root</literal> role assignments.</para><screen>% <userinput>whoami</userinput>
jdoe-local
% <userinput>su - root</userinput>
Password: <userinput>a!2@3#4$5%6^7</userinput>
# <userinput>grep roles /etc/user_attr</userinput>
jdoe-local::::type=normal;roles=<emphasis>root</emphasis>
kdoe-local::::type=normal;roles=<emphasis>root</emphasis>
# <userinput>usermod -R "" jdoe-local</userinput>
# <userinput>usermod -R "" kdoe-local</userinput>
# <userinput>grep roles /etc/user_attr</userinput>
#</screen><para>Still in the <literal>root</literal> role, the administrator changes <literal>root</literal> into a user.</para><screen># <userinput>rolemod -K type=normal root</userinput></screen><para>Then, the administrator verifies the change in the <literal>root</literal> entry
in the <filename>user_attr</filename> file.</para><screen># <userinput>grep root /etc/user_attr</userinput>
root::::type=<emphasis>normal</emphasis>;auths=solaris.*,solaris.grant;profiles=...</screen>
</example><taskrelated role="troubleshooting"><para>In a desktop environment, you cannot directly log in as <literal>root</literal> when <literal>root</literal> is a role. A diagnostic message indicates that <literal>root</literal> is
a role on your system. If you do not have a local account that can assume
the <literal>root</literal> role, create one. As <literal>root</literal>,
log in to the system in single-user mode, create a local user account, and
assign the <literal>root</literal> role to the new account. Then, log in as
the new user and assume the <literal>root</literal> role.</para><itemizedlist><para>No one can become superuser if you change the <literal>root</literal> user
into a role and fail to make one of the following assignments:</para><listitem><para>Assign the <literal>root</literal> role to a valid user.</para>
</listitem><listitem><para>Assign a rights profile that is equivalent to <literal>root</literal>'s
rights profile to a valid user. The Primary Administrator profile is an equivalent
rights profile for <literal>root</literal> capabilities.</para>
</listitem><listitem><para>Create a role that has the capabilities of <literal>root</literal> and
assign the role to a valid user. A role that is assigned the Primary Administrator
profile is equivalent to the <literal>root</literal> role.</para>
</listitem>
</itemizedlist>
</taskrelated>
</task>
</sect1><sect1 id="rbactask-40"><title>Using Roles (Task Map)</title><para><indexterm><primary>task maps</primary><secondary>using roles</secondary></indexterm><indexterm><primary>using</primary><secondary>roles task map</secondary></indexterm><indexterm><primary>assuming role</primary><secondary>how to</secondary></indexterm><indexterm><primary>user procedures</primary><secondary>assuming a role</secondary></indexterm><indexterm><primary>user procedures</primary><secondary>using an assigned role</secondary></indexterm>The following task
map points to procedures for using your role after roles have been assigned.</para><informaltable frame="all" pgwide="1"><tgroup cols="3" colsep="1" rowsep="1"><colspec colname="colspec6" colwidth="21.40*"/><colspec colname="colspec7" colwidth="38.80*"/><colspec colname="colspec8" colwidth="38.80*"/><thead><row><entry><para>Task</para>
</entry><entry><para>Description</para>
</entry><entry><para>For Instructions</para>
</entry>
</row>
</thead><tbody><row><?PubTbl row rht="1.04in"?><entry><para>Use the Solaris Management Console</para>
</entry><entry><para>Authenticate yourself as a role to perform administrative tasks in the
Solaris Management Console.</para>
</entry><entry><para><olink targetptr="rbactask-21" remap="internal">How to Assume a Role in the Solaris Management
Console</olink></para>
</entry>
</row><row><?PubTbl row rht="1.04in"?><entry><para>Assume a role in a terminal window</para>
</entry><entry><para>Perform command-line administrative tasks in a profile shell.</para>
</entry><entry><para><olink targetptr="rbactask-2" remap="internal">How to Assume a Role in a Terminal Window</olink></para>
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</sect1><sect1 id="rbactask-42"><title>Using Roles</title><para><indexterm><primary>using</primary><secondary>roles</secondary></indexterm>After you have set up roles with default Solaris rights profiles,
and assigned the roles to users, the roles can be used. A role can be assumed
on the command line. In the Solaris Management Console, a role can also be
used for administering the system locally and over the network.</para><task id="rbactask-2"><title>How to Assume a Role in a Terminal
Window</title><indexterm><primary>roles</primary><secondary>assuming in a terminal window</secondary>
</indexterm><indexterm><primary>assuming role</primary><secondary>in a terminal window</secondary>
</indexterm><indexterm><primary>roles</primary><secondary>assuming</secondary>
</indexterm><indexterm><primary><command>su</command> command</primary><secondary>in role assumption</secondary>
</indexterm><indexterm><primary>roles</primary><secondary>using an assigned role</secondary>
</indexterm><taskprerequisites><para>The role must already be assigned to you. The name service must be updated
with that information.</para>
</taskprerequisites><procedure><step><para><indexterm><primary><command>roles</command> command</primary><secondary>using</secondary></indexterm><indexterm><primary>displaying</primary><secondary>roles you can assume</secondary></indexterm><indexterm><primary>listing</primary><secondary>roles you can assume</secondary></indexterm><indexterm><primary>roles</primary><secondary>listing local roles</secondary></indexterm>In
a terminal window, determine which roles you can assume.</para><screen>% roles
<replaceable>Comma-separated list of role names is displayed</replaceable></screen>
</step><step><para>Use the <command>su</command> command to assume a role.</para><screen>% su - <replaceable>rolename</replaceable>
Password: <lineannotation>&lt;Type rolename password&gt;</lineannotation>
$</screen><para>The <command>su -</command> <replaceable>rolename</replaceable> command
changes the shell to a profile shell for the role. A profile shell recognizes
security attributes (authorizations, privileges, and set ID bits).</para>
</step><step><para>Verify that you are now in a role.</para><screen>$ /usr/ucb/whoami
<replaceable>rolename</replaceable></screen><para>You can now perform role tasks in this terminal window.</para>
</step><step performance="optional"><para>View the capabilities of your role.</para><para>For the procedure, see <olink targetptr="privtask-24" remap="internal">How to Determine
the Privileged Commands That a Role Can Run</olink>.</para>
</step>
</procedure><example id="rbactask-11"><title>Assuming the Primary Administrator Role</title><indexterm><primary>roles</primary><secondary>assuming Primary Administrator role</secondary>
</indexterm><indexterm><primary>assuming role</primary><secondary>Primary Administrator</secondary>
</indexterm><indexterm><primary>Primary Administrator (RBAC)</primary><secondary>assuming role</secondary>
</indexterm><para>In the following example, the user assumes the role of Primary Administrator.
In the default configuration, this role is equivalent to superuser. The role
then checks to see which privileges are available to any command that is typed
in the profile shell for the role.</para><screen>% <userinput>roles</userinput>
sysadmin,oper,primaryadm
% <userinput>su - primaryadm</userinput>
Password: <lineannotation>&lt;Type primaryadm password&gt;</lineannotation>
$ <userinput>/usr/ucb/whoami</userinput> <lineannotation>Prompt has changed to role prompt</lineannotation>
primaryadm
$ <userinput>ppriv $$</userinput>
1200:   pfksh
flags = &lt;none&gt;
        E (Effective): all
        I (Inheritable): basic
        P (Permitted): all
        L (Limit): all</screen><para>For information about privileges, see <olink targetptr="prbac-2" remap="internal">Privileges
(Overview)</olink>.</para>
</example><example id="rbactask-57"><title>Assuming the <literal>root</literal> Role</title><indexterm><primary>roles</primary><secondary>assuming <literal>root</literal> role</secondary>
</indexterm><indexterm><primary>assuming role</primary><secondary><literal>root</literal></secondary>
</indexterm><indexterm><primary><literal>root</literal> role (RBAC)</primary><secondary>assuming role</secondary>
</indexterm><para>In the following example, the user assumes the <literal>root</literal> role.
The role was created in <olink targetptr="rbactask-20" remap="internal">How to Make root User
Into a Role</olink></para><screen>% <userinput>roles</userinput>
root
% <userinput>su - root</userinput>
Password: <lineannotation>&lt;Type root password&gt;</lineannotation>
# <userinput>/usr/ucb/whoami</userinput> <lineannotation>Prompt has changed to role prompt</lineannotation>
root
$ <userinput>ppriv $$</userinput>
1200:   pfksh
flags = &lt;none&gt;
        E: all
        I: basic
        P: all
        L: all</screen><para>For information about privileges, see <olink targetptr="prbac-2" remap="internal">Privileges
(Overview)</olink>.</para>
</example><example id="rbactask-13"><title>Assuming the System Administrator Role</title><indexterm><primary>roles</primary><secondary>assuming System Administrator role</secondary>
</indexterm><indexterm><primary>assuming role</primary><secondary>System Administrator</secondary>
</indexterm><indexterm><primary>System Administrator (RBAC)</primary><secondary>assuming role</secondary>
</indexterm><para>In the following example, the user assumes the role of System Administrator.
In contrast to the Primary Administrator role, the System Administrator has
the basic set of privileges in its effective set.</para><screen>% <userinput>roles</userinput>
sysadmin,oper,primaryadm
% <userinput>su - sysadmin</userinput>
Password: <lineannotation>&lt;Type sysadmin password&gt;</lineannotation>
$ <userinput>/usr/ucb/whoami</userinput> <lineannotation>Prompt has changed to role prompt</lineannotation>
sysadmin
$ <userinput>ppriv $$</userinput>
1200:   pfksh
flags = &lt;none&gt;
        E: basic
        I: basic
        P: basic
        L: all</screen><para>For information about privileges, see <olink targetptr="prbac-2" remap="internal">Privileges
(Overview)</olink>. For a short description of the capabilities of the role,
see <olink targetptr="rbacref-23" remap="internal">System Administrator Rights Profile</olink>.</para>
</example>
</task><task id="rbactask-21"><title>How to Assume a Role in the Solaris
Management Console</title><indexterm><primary>roles</primary><secondary>assuming in Solaris Management Console</secondary>
</indexterm><indexterm><primary>assuming role</primary><secondary>in Solaris Management Console</secondary>
</indexterm><indexterm><primary>RBAC</primary><secondary>using privileged applications</secondary>
</indexterm><indexterm><primary>roles</primary><secondary>assuming</secondary>
</indexterm><indexterm><primary><command>su</command> command</primary><secondary>in role assumption</secondary>
</indexterm><indexterm><primary>roles</primary><secondary>using an assigned role</secondary>
</indexterm><tasksummary><para>To change information in the Solaris Management Console GUI requires
administrative capabilities. A role gives you administrative capabilities.
If you want to view information, you must have the <systemitem>solaris.admin.usermgr.read</systemitem> authorization. The Basic Solaris User rights profile includes
this authorization.</para>
</tasksummary><taskprerequisites><para>An administrative role that can change the properties of users or roles
must have already been assigned to you. For example, the Primary Administrator
role can change the properties of users or roles.</para>
</taskprerequisites><procedure><step><para>Start the Solaris Management Console.</para><screen>% <userinput>/usr/sbin/smc &amp;</userinput></screen><para>For detailed instructions, see <olink targetdoc="group-sa" targetptr="smcover-95" remap="external"><citetitle remap="section">Using the Solaris Management Tools With RBAC (Task Map)</citetitle> in <citetitle remap="book">System Administration Guide: Basic Administration</citetitle></olink>.</para>
</step><step><para>Select the toolbox for your task.</para><para>Navigate to the
toolbox that contains the tool or collection in the appropriate name service
scope and click the icon. The scopes are files (local), NIS, NIS+, and LDAP.
If the appropriate toolbox is not displayed in the navigation pane, choose
Open Toolbox from the Console menu and load the relevant toolbox.</para>
</step><step><para>Select the tool that you want to use.</para><para>Navigate to
the tool or collection and click the icon. The tools for managing the RBAC
elements are in the Users tool, as shown in the following figure.</para><mediaobject><imageobject><imagedata entityref="usercoll.tiff"/>
</imageobject><textobject><simpara>Window titled Management Tools shows the Navigation pane
on the left, the Tools pane on the right, and the Information pane with Context
Help below.</simpara>
</textobject>
</mediaobject>
</step><step><para>Type your user name and password in the Login: User Name dialog
box.</para>
</step><step><para>Authenticate yourself in the Login: Role dialog box.</para><para>The
Role option menu in the dialog box displays the roles that are assigned to
you. Choose a role and type the role password.</para>
</step>
</procedure>
</task>
</sect1><sect1 id="rbactask-10"><title>Managing RBAC (Task Map)</title><indexterm><primary>managing</primary><secondary>RBAC task map</secondary>
</indexterm><indexterm><primary>task maps</primary><secondary>managing RBAC</secondary>
</indexterm><para>The following task map points to procedures for customizing role-based
access control (RBAC) after RBAC has been initially implemented.</para><informaltable frame="all" pgwide="1"><tgroup cols="3" colsep="1" rowsep="1"><colspec colname="colspec6" colwidth="21.34*"/><colspec colname="colspec7" colwidth="43.14*"/><colspec colname="colspec8" colwidth="34.52*"/><thead><row><entry><para>Task</para>
</entry><entry><para>Description</para>
</entry><entry><para>For Instructions</para>
</entry>
</row>
</thead><tbody><row><entry><para>Change the role password</para>
</entry><entry><para>An authorized user or role changes the password of another role.</para>
</entry><entry><para><olink targetptr="rbactask-56" remap="internal">How to Change the Password of a Role</olink></para>
</entry>
</row><row><entry><para>Modify the properties of a role</para>
</entry><entry><para>Modifies the capabilities (privileges, privileged commands, profiles,
or authorizations) of a role.</para>
</entry><entry><para><olink targetptr="rbactask-23" remap="internal">How to Change the Properties of a Role</olink></para>
</entry>
</row><row><entry><para>Create or change rights profiles</para>
</entry><entry><para>Creates a rights profile. Or modifies the authorizations, privileged
commands, or supplementary rights profiles in a rights profile.</para>
</entry><entry><para><olink targetptr="rbactask-24" remap="internal">How to Create or Change a Rights Profile</olink></para>
</entry>
</row><row><entry><para>Change a user's administrative capabilities</para>
</entry><entry><para>Adds a role, a rights profile, an authorization, or privileges to an
ordinary  user.</para>
</entry><entry><para><olink targetptr="rbactask-25" remap="internal">How to Change the RBAC Properties of
a User</olink></para>
</entry>
</row><row><entry><para>Secure legacy applications</para>
</entry><entry><para>Turns on the set ID permissions for legacy applications. Scripts can
contain commands with set IDs. Legacy applications can check for authorizations,
if appropriate.</para>
</entry><entry><para><olink targetptr="rbactask-26" remap="internal">How to Add RBAC Properties to Legacy
Applications</olink></para>
</entry>
</row>
</tbody>
</tgroup>
</informaltable><para>These procedures manage the elements that are used in RBAC. For user
management procedures, refer to <olink targetdoc="group-sa" targetptr="usersetup-92366" remap="external">Chapter 5, <citetitle remap="chapter">Managing User Accounts and Groups (Tasks),</citetitle> in <citetitle remap="book">System Administration Guide: Basic Administration</citetitle></olink>.</para>
</sect1><sect1 id="rbactask-4"><title>Managing RBAC</title><para>The Solaris Management Console GUI is the preferred method for managing
RBAC.</para><note><para>Do not attempt to administer RBAC with the command line and the
graphical user interface at the same time. Conflicting changes could be made
to the configuration, and the behavior would be unpredictable. Both tools
can administer RBAC, but you cannot use both tools concurrently.</para>
</note><task id="rbactask-56"><title>How to Change the Password of a Role</title><indexterm><primary>roles</primary><secondary>changing password of</secondary>
</indexterm><indexterm><primary>passwords</primary><secondary>changing role password</secondary>
</indexterm><indexterm><primary>changing</primary><secondary>password of role</secondary>
</indexterm><indexterm><primary>administering</primary><secondary>role password</secondary>
</indexterm><indexterm><primary>RBAC</primary><secondary>changing role passwords</secondary>
</indexterm><indexterm><primary><command>passwd</command> command</primary><secondary>changing password of role</secondary>
</indexterm><taskprerequisites><para>You must have assumed a role that includes the User Security profile
or have switched to superuser. You cannot be in the role whose password you
want to change. A role cannot change its own password.</para>
</taskprerequisites><procedure remap="single-step"><step><para>Use one of the following methods to change a role's password.</para><stepalternatives><step><para>As superuser or in a role that includes the User Security rights
profile, run the <command>passwd</command> command.</para><screen>$ passwd  -r <replaceable>naming-service</replaceable> <replaceable>target-rolename</replaceable></screen><variablelist><varlistentry><term><option>r</option> <replaceable>naming-service</replaceable></term><listitem><para>Applies the password change to one of the following repositories <literal>files</literal>, <literal>nis</literal>, <literal>nisplus</literal>, or <literal>ldap</literal>. If a repository is not specified, the password is changed
in <literal>files</literal>.</para>
</listitem>
</varlistentry><varlistentry><term><replaceable>target-rolename</replaceable></term><listitem><para>Is the name of an existing role that you want to modify.</para>
</listitem>
</varlistentry>
</variablelist><para>For more command options, see the <olink targetdoc="group-refman" targetptr="passwd-1" remap="external"><citerefentry><refentrytitle>passwd</refentrytitle><manvolnum>1</manvolnum></citerefentry></olink> man page.</para>
</step><step><para>Change the password in the Solaris Management Console.</para><para>To
start the console, see <olink targetptr="rbactask-21" remap="internal">How to Assume a Role
in the Solaris Management Console</olink>. </para><substeps><step><para>Log in to the console as superuser or in a role that includes
the User Security rights profile.</para><para>The login role cannot be the
target role.</para>
</step><step><para>Choose the appropriate scope.</para><para>The <literal>Files</literal> scope
modifies the role password on the local system. The <literal>LDAP</literal> scope
modifies the role password in the LDAP naming service.</para>
</step><step><para>Navigate to Administrative Roles and follow the instructions in
the left-hand pane.</para><para>For more extensive information, see the online
help.</para>
</step>
</substeps>
</step><step><para>As superuser or in a role  that includes the User Security rights
profile, run the <command>smrole</command> command with the <command>modify</command> subcommand.</para><para><indexterm><primary><command>smrole</command> command</primary><secondary>changing properties of role</secondary></indexterm>This command
runs as a client of the Solaris Management Console server.</para><screen>$ /usr/sadm/bin/smrole -D <replaceable>domain-name</replaceable> -r <replaceable>admin-role</replaceable> -l <replaceable>&lt;Type admin-role password&gt;</replaceable> \
modify -- -n <replaceable>target-rolename</replaceable>  -P <replaceable>password</replaceable></screen><variablelist><varlistentry><term><option>D</option> <replaceable>domain-name</replaceable></term><listitem><para>Is the name of the domain that you want to manage.</para>
</listitem>
</varlistentry><varlistentry><term><option>r</option> <replaceable>admin-role</replaceable></term><listitem><para>Is the name of the administrative role that can modify the
target role. The administrative role must have the <literal>solaris.admin.usermgr.pswd</literal> authorization. The administrative role and the target role cannot
be the same role.</para>
</listitem>
</varlistentry><varlistentry><term><option>l</option></term><listitem><para>Is the prompt for the password of <replaceable>admin-role</replaceable>.</para>
</listitem>
</varlistentry><varlistentry><term><literal>--</literal></term><listitem><para>Is the required separator between authentication options and
subcommand options.</para>
</listitem>
</varlistentry><varlistentry><term><option>n</option> <replaceable>target-rolename</replaceable></term><listitem><para>Is the name of the target role.</para>
</listitem>
</varlistentry><varlistentry><term><option>P</option> <replaceable>password</replaceable></term><listitem><para>Is the new password for <replaceable>target-rolename</replaceable>.</para>
</listitem>
</varlistentry>
</variablelist><para>For the full list of command options, see the <olink targetdoc="group-refman" targetptr="smrole-1m" remap="external"><citerefentry><refentrytitle>smrole</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink> man page.</para>
</step>
</stepalternatives>
</step>
</procedure><example id="rbactask-48"><title>Changing a Local Role's Password With the <command>passwd</command> Command</title><para>In this example, superuser changes the password of the local <literal>operadm</literal> role.</para><screen># <userinput>passwd -r files  operadm</userinput>
New password: <lineannotation>Type new password</lineannotation>
Re-enter new password: <lineannotation>Retype new password</lineannotation></screen>
</example><example id="rbactask-52"><title>Changing a Role's Password in an LDAP Repository</title><para>In this example, the Primary Admin role changes the password of the <literal>operadm</literal> role in the LDAP directory service.</para><screen>$ <userinput>passwd -r ldap operadm</userinput>
New password: <lineannotation>Type new password</lineannotation>
Re-enter new password: <lineannotation>Retype new password</lineannotation></screen>
</example><example id="rbactask-54"><title>Changing a Role's Password With the <command>smrole modify</command> Command</title><para>In this example, the administrator contacts the Solaris Management Console
server to change the <literal>operadm</literal> password in the NIS domain.
When the administrator does not provide the password before pressing the Return
key, the <literal>New Password:</literal> prompt appears.</para><screen>$ <userinput>/usr/sadm/bin/smrole -D nis:/examplehost/example.domain \</userinput>
<userinput>-r primaryadm -l</userinput> <replaceable>&lt;Type primaryadm password&gt;</replaceable> <userinput>\</userinput>
<userinput>modify -- -n operadm -P</userinput> <lineannotation>Press the Return key</lineannotation>
New Password: a!2@3#4$5%6*7
$</screen>
</example>
</task><task id="rbactask-23"><title>How to Change the Properties of a
Role</title><indexterm><primary>roles</primary><secondary>changing properties of</secondary>
</indexterm><indexterm><primary>roles</primary><secondary>modifying</secondary>
</indexterm><indexterm><primary>changing</primary><secondary>properties of role</secondary>
</indexterm><indexterm><primary>administering</primary><secondary>properties of a role</secondary>
</indexterm><indexterm><primary>configuring</primary><secondary>roles</secondary>
</indexterm><indexterm><primary>modifying</primary><secondary>roles (RBAC)</secondary>
</indexterm><indexterm><primary>obtaining</primary><secondary>privileged commands</secondary>
</indexterm><indexterm><primary>RBAC</primary><secondary>modifying roles</secondary>
</indexterm><taskprerequisites><para>You must have assumed the role of Primary Administrator or have switched
to superuser to change the properties of a role. Role properties include password,
rights profiles, and authorizations.</para><note><para>To change a role's password property, see <olink targetptr="rbactask-56" remap="internal">How to Change the Password of a Role</olink>.</para>
</note>
</taskprerequisites><procedure remap="single-step"><step><para>Use one of the following methods to change the properties of a
role.</para><stepalternatives><step><para>Use the Users tool in the Solaris Management Console.</para><para>To
start the console, see <olink targetptr="rbactask-21" remap="internal">How to Assume a Role
in the Solaris Management Console</olink>. Follow the instructions in the
left-hand pane to modify a role in Administrative Roles. For more extensive
information, see the online help.</para>
</step><step><para>Use the <command>rolemod</command> command.</para><para><indexterm><primary><command>rolemod</command> command</primary><secondary>changing properties of role</secondary></indexterm>This command modifies the attributes of a role
that is defined in the local name service.</para><screen>$ rolemod -c <replaceable>comment</replaceable> -P <replaceable>profile-list</replaceable> <replaceable>rolename</replaceable></screen><variablelist><varlistentry><term><option>c</option> <replaceable>comment</replaceable></term><listitem><para>Is the new comment that describes the capabilities of the
role.</para>
</listitem>
</varlistentry><varlistentry><term><option>P</option> <replaceable>profile-list</replaceable></term><listitem><para>Is the list of the profiles that are included in the role.
This list replaces the current list of profiles.</para>
</listitem>
</varlistentry><varlistentry><term><replaceable>rolename</replaceable></term><listitem><para>Is the name of an existing, local role that you want to modify.</para>
</listitem>
</varlistentry>
</variablelist><para>For more command options, see the <olink targetdoc="group-refman" targetptr="rolemod-1m" remap="external"><citerefentry><refentrytitle>rolemod</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink> man page.</para>
</step><step><para>Use the <command>smrole</command> command with the <command>modify</command> subcommand.</para><para><indexterm><primary><command>smrole</command> command</primary><secondary>changing properties of role</secondary></indexterm>This
command modifies the attributes of a role in a distributed name service, such
as NIS, NIS+, or LDAP. This command runs as a client of the Solaris Management
Console server.</para><screen>$ /usr/sadm/bin/smrole -D <replaceable>domain-name</replaceable> \ 
-r <replaceable>admin-role</replaceable> -l <replaceable>&lt;Type admin-role password&gt;</replaceable> \
modify -- -n <replaceable>rolename</replaceable>  -r <replaceable>username</replaceable> -u <replaceable>username</replaceable></screen><variablelist><varlistentry><term><option>D</option> <replaceable>domain-name</replaceable></term><listitem><para>Is the name of the domain that you want to manage.</para>
</listitem>
</varlistentry><varlistentry><term><option>r</option> <replaceable>admin-role</replaceable></term><listitem><para>Is the name of the administrative role that can modify the
role. The administrative role must have the <literal>solaris.role.assign</literal> authorization.
If you are modifying a role that you have assumed, the role must have the <literal>solaris.role.delegate</literal> authorization.</para>
</listitem>
</varlistentry><varlistentry><term><option>l</option></term><listitem><para>Is the prompt for the password of <replaceable>admin-role</replaceable>.</para>
</listitem>
</varlistentry><varlistentry><term><literal>--</literal></term><listitem><para>Is the required separator between authentication options and
subcommand options.</para>
</listitem>
</varlistentry><varlistentry><term><option>n</option> <replaceable>rolename</replaceable></term><listitem><para>Is the name of the new role.</para>
</listitem>
</varlistentry><varlistentry><term><option>r</option> <replaceable>username</replaceable></term><listitem><para>Is the name of the user who can no longer assume <replaceable>rolename</replaceable>.</para>
</listitem>
</varlistentry><varlistentry><term><option>u</option> <replaceable>username</replaceable></term><listitem><para>Is the name of the user who can now assume <replaceable>rolename</replaceable>.</para>
</listitem>
</varlistentry>
</variablelist><para>For more command options, see the <olink targetdoc="group-refman" targetptr="smrole-1m" remap="external"><citerefentry><refentrytitle>smrole</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink> man page.</para>
</step>
</stepalternatives>
</step>
</procedure><example id="rbactask-33"><title>Changing a Local Role's Properties With the <command>rolemod</command> Command</title><para>In this example, the <literal>operadm</literal> role is modified to
include the Media Restore rights profile.</para><screen>$ <userinput>rolemod -c "Handles printers, backup, AND restore" \</userinput>
<userinput>-P "Printer Management,Media Backup,Media Restore,All" operadm</userinput></screen>
</example><example id="rbactask-45"><title>Changing a Local Role's Properties With the <command>smrole modify</command> Command</title><para>In the following example, the <literal>operadm</literal> role is modified
to add the Media Restore rights profile.</para><screen>$ <userinput>/usr/sadm/bin/smrole -r primaryadm -l</userinput> <replaceable>&lt;Type primaryadm password&gt;</replaceable> <userinput>\</userinput>
<userinput>modify -- -n operadm -c "Handles printers, backup, AND restore" \</userinput>
<userinput>-p "Media Restore"</userinput></screen>
</example><example id="rbactask-43"><title>Changing a Role in a Domain With the <command>smrole modify</command> Command</title><para>In the following example, the <literal>clockmgr</literal> role is changed.
The NIS user whose ID is <literal>108</literal> can no longer assume the role.
The NIS user whose ID is <literal>110</literal> can assume the role <literal>clockmgr</literal>.</para><screen>$ <userinput>/usr/sadm/bin/smrole -D nis:/examplehost/example.domain \</userinput>
<userinput>-r primaryadm -l</userinput> <replaceable>&lt;Type primaryadm password&gt;</replaceable> <userinput>\</userinput>
<userinput>modify -- -n clockmgr -r 108 -u 110</userinput></screen>
</example>
</task><task id="rbactask-24"><title>How to Create or Change a Rights Profile</title><indexterm><primary>changing</primary><secondary>rights profile contents</secondary>
</indexterm><indexterm><primary>rights profiles</primary><secondary>changing contents of</secondary>
</indexterm><indexterm><primary>rights profiles</primary><secondary>methods of creating</secondary>
</indexterm><indexterm><primary>rights profiles</primary><secondary>modifying</secondary>
</indexterm><indexterm><primary>adding</primary><secondary>new rights profile</secondary>
</indexterm><indexterm><primary>creating</primary><secondary>rights profiles</secondary>
</indexterm><indexterm><primary>administering</primary><secondary>rights profiles</secondary>
</indexterm><indexterm><primary>administering</primary><secondary>RBAC properties</secondary>
</indexterm><indexterm><primary>RBAC</primary><secondary>editing rights profiles</secondary>
</indexterm><indexterm><primary>Rights tool</primary><secondary>description</secondary>
</indexterm><indexterm><primary>adding</primary><secondary>attributes to a rights profile</secondary>
</indexterm><indexterm><primary>configuring</primary><secondary>rights profiles</secondary>
</indexterm><tasksummary><para>A rights profile is a property of a role. You should create or change
a rights profile when the <filename>prof_attr</filename> database does not
contain a rights profile that fulfills your needs. To learn more about rights
profiles, see <olink targetptr="rbac-33" remap="internal">RBAC Rights Profiles</olink>.</para>
</tasksummary><taskprerequisites><para>To create or change a rights profile, you must have assumed the role
of Primary Administrator or have switched to superuser.</para>
</taskprerequisites><procedure remap="single-step"><step><para>Use one of the following methods to create or change a rights
profile.</para><stepalternatives><step><para><indexterm><primary>configuring</primary><secondary>rights profiles</secondary></indexterm>Use the Users tool in the Solaris Management Console.</para><para>To
start the console, see <olink targetptr="rbactask-21" remap="internal">How to Assume a Role
in the Solaris Management Console</olink>. Follow the instructions in the
left-hand pane to create or change a rights profile in Rights. For more extensive
information, see the online help.</para>
</step><step><para><indexterm><primary><command>smprofile</command> command</primary><secondary>changing rights profile</secondary></indexterm>Use the <command>smprofile</command> command.</para><para><indexterm><primary>deleting</primary><secondary>rights profiles</secondary></indexterm><indexterm><primary>rights profiles</primary><secondary>creating</secondary><tertiary>on command line</tertiary></indexterm>This command enables you to add, modify, list, or delete a rights
profile. The command works on files, and in a distributed name service, such
as NIS, NIS+, or LDAP. The <command>smprofile</command> command runs as a
client of the Solaris Management Console server.</para><screen>$ /usr/sadm/bin/smprofile -D <replaceable>domain-name</replaceable> \ 
-r <replaceable>admin-role</replaceable> -l <replaceable>&lt;Type admin-role password&gt;</replaceable> \
add | modify -- -n <replaceable>profile-name</replaceable> \
-d <replaceable>description</replaceable>  -m <replaceable>help-file</replaceable> -p <replaceable>supplementary-profile</replaceable></screen><variablelist><varlistentry><term><option>D</option> <replaceable>domain-name</replaceable></term><listitem><para>Is the name of the domain that you want to manage.</para>
</listitem>
</varlistentry><varlistentry><term><option>r</option> <replaceable>admin-role</replaceable></term><listitem><para>Is the name of the administrative role that can modify the
role. The administrative role must have the <literal>solaris.role.assign</literal> authorization.
If you are modifying a role that you have assumed, the role must have the <literal>solaris.role.delegate</literal> authorization.</para>
</listitem>
</varlistentry><varlistentry><term><option>l</option></term><listitem><para>Is the prompt for the password of <replaceable>admin-role</replaceable>.</para>
</listitem>
</varlistentry><varlistentry><term><literal>--</literal></term><listitem><para>Is the required separator between authentication options and
subcommand options.</para>
</listitem>
</varlistentry><varlistentry><term><option>n</option> <replaceable>profile-name</replaceable></term><listitem><para>Is the name of the new profile.</para>
</listitem>
</varlistentry><varlistentry><term><option>d</option> <replaceable>description</replaceable></term><listitem><para>Is a short description of the profile.</para>
</listitem>
</varlistentry><varlistentry><term><option>m</option> <replaceable>help-file</replaceable></term><listitem><para>Is the name of the HTML help file that you have created and
placed in the <filename>/usr/lib/help/profiles/locale/C</filename> directory.</para>
</listitem>
</varlistentry><varlistentry><term><option>p</option> <replaceable>supplementary-profile</replaceable></term><listitem><para>Is the name of an existing rights profile that is included
in this rights profile. You can specify multiple <option>p</option> <replaceable>supplementary-profile</replaceable> options.</para>
</listitem>
</varlistentry>
</variablelist><para>For more command options, see the <olink targetdoc="group-refman" targetptr="smprofile-1m" remap="external"><citerefentry><refentrytitle>smprofile</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink> man page.</para>
</step>
</stepalternatives>
</step>
</procedure><example id="rbactask-47"><title>Modifying a Rights Profile From the Command Line</title><para><indexterm><primary>changing</primary><secondary>rights profile from command line</secondary></indexterm><indexterm><primary>configuring</primary><secondary>rights profile from command line</secondary></indexterm><indexterm><primary>rights profiles</primary><secondary>changing from command line</secondary></indexterm>In the following example, the Network Management rights profile
is made a supplementary profile of the Network Security rights profile. The
role that contains the Network Security profile can now configure the network
and hosts, as well has run security-relevant commands.</para><screen>$ <userinput>/usr/sadm/bin/smprofile -D nisplus:/example.host/example.domain \</userinput>
<userinput>-r primaryadm -l</userinput> <replaceable>&lt;Type primaryadm password&gt;</replaceable> <userinput>\</userinput>
<userinput>modify -- -n "Network Security" \</userinput>
<userinput>-d "Manage network and host configuration and security" \</userinput>
<userinput>-m RtNetConfSec.html -p "Network Management"</userinput></screen><para>The administrator created a new help file, <filename>RtNetConfSec.html</filename>,
and placed it in the <filename>/usr/lib/help/profiles/locale/C</filename> directory,
before running this command.</para>
</example><example id="rbactask-38"><title>Modifying an Existing Rights Profile</title><para>In the following example, the security administrator of MyCompany customizes
the Console User rights profile. Another goal is to retain the customized
rights profile when the Solaris OS is updated to a later version.</para><para>First, the administrator closes the Solaris Management Console.</para><para>Then, the administrator opens the <filename>prof_attr</filename> file,
copies the Console User rights profile to the next line, and renames the second
entry. The administrator uses the existing help file, <filename>RtConsUser.html</filename>.</para><screen># <userinput>vi /etc/security/prof_attr</userinput>
Console User:::Manage System as the Console User:help=RtConsUser.html
<userinput>MyCompany</userinput> Console User:::Manage System as the Console User:help=RtConsUser.html</screen><para>The administrator assumes the secadmin role. The secadmin role can modify
the security features of a system. The secadmin role opens the Solaris Management
Console, clicks the System Configuration and the Users tool, types the role
password, and double-clicks the Rights tool.</para><para>The administrator double-clicks the MyCompany Console User rights profile.
Under the Authorizations tab, the administrator adds two authorizations to
the Authorizations Included list and saves the changes. When the system is
patched or updated to a later version of the Solaris OS, the Console User rights
profile is updated and the MyCompany Console User rights profile is not changed.</para>
</example><example id="rbactask-49"><title>Creating a New Rights Profile With the Rights Tool</title><para><indexterm><primary>RBAC</primary><secondary>adding new rights profile</secondary></indexterm><indexterm><primary>adding</primary><secondary>rights profiles with Solaris Management Console</secondary></indexterm><indexterm><primary>rights profiles</primary><secondary>creating</secondary><tertiary>in Solaris Management Console</tertiary></indexterm><indexterm><primary>creating</primary><secondary>rights profiles with Solaris Management Console</secondary></indexterm>The following
table shows sample data for a hypothetical rights profile that is called &ldquo;Build
Administrator&rdquo;. This rights profile includes the commands in the subdirectory <filename class="directory">/usr/local/swctrl/bin</filename>. These commands have an
effective UID of <literal>0</literal>. The Build Administrator rights profile
would be useful for administrators who manage the builds and versioning for
software development.</para><informaltable frame="topbot" pgwide="1"><tgroup cols="3" colsep="0" rowsep="0"><colspec colname="colspec0" colwidth="19.50*"/><colspec colname="colspec1" colwidth="25.72*"/><colspec colname="colspec2" colwidth="53.79*"/><thead><row rowsep="1"><entry><para>Tab</para>
</entry><entry><para>Field</para>
</entry><entry><para>Example</para>
</entry>
</row>
</thead><tbody><row><entry><para>General</para>
</entry><entry><para>Name</para>
</entry><entry><para>Build Administrator</para>
</entry>
</row><row><entry><para></para>
</entry><entry><para>Description</para>
</entry><entry><para>For managing software builds and versioning.</para>
</entry>
</row><row><entry><para></para>
</entry><entry><para>Help File Name</para>
</entry><entry><para><filename>BuildAdmin.html</filename></para>
</entry>
</row><row><entry><para>Commands</para>
</entry><entry><para>Add Directory</para>
</entry><entry><para>Click Add Directory, type <filename class="directory">/usr/local/swctrl/bin</filename> in the dialog box, and click OK.</para>
</entry>
</row><row><entry><para></para>
</entry><entry><para>Commands Denied / Commands Permitted</para>
</entry><entry><para>Move <filename class="directory">/usr/local/swctrl/bin</filename> to
the Commands Permitted column.</para>
</entry>
</row><row><entry><para></para>
</entry><entry><para>Set Security Attributes</para>
</entry><entry><para>Select <filename class="directory">/usr/local/swctrl/bin</filename>,
click Set Security Attributes, and set Effective UID = <literal>root</literal>.</para>
</entry>
</row><row><entry><para>Authorizations</para>
</entry><entry><para>Authorizations Excluded / Authorizations Included</para>
</entry><entry><para><emphasis>No authorizations.</emphasis></para>
</entry>
</row><row><entry><para>Supplementary Rights</para>
</entry><entry><para>Rights Excluded / Rights Included</para>
</entry><entry><para><emphasis>No supplementary rights profiles.</emphasis></para>
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</example><taskrelated role="troubleshooting"><itemizedlist><para><indexterm><primary>troubleshooting</primary><secondary>rights profiles</secondary></indexterm><indexterm><primary>rights profiles</primary><secondary>troubleshooting</secondary></indexterm>Check the following if the rights profile does not
provide the role with the capabilities that you expect:</para><listitem><para>Are the rights profiles for the role listed in the GUI from
most to least powerful?</para><para>For example, if the <literal>All</literal> rights
profile is at the top of the list, then no commands are run with security
attributes. A profile that contains commands with security attributes must
precede the <literal>All</literal> rights profile in the list.</para>
</listitem><listitem><para>Is a command listed more than once in the role's rights profiles?
If so, does the first instance of the command have all the security attributes
that are required?</para><para>For example, a command can require privileges
for particular options to the command. For the options that require privileges
to succeed, the first instance of the command in the highest rights profile
in the list must have the assigned privileges.</para>
</listitem><listitem><para>Do the commands in the role's rights profiles have the appropriate
security attributes?</para><para>For example, when the policy is <literal>suser</literal>,
some commands require <literal>uid=0</literal> rather than <literal>euid=0</literal> to
succeed.</para>
</listitem><listitem><para>Has the name service cache, <literal>svc:/system/name-service-cache</literal>, been restarted?</para><para>The <command>nscd</command> daemon
can have a lengthy time-to-live interval. By restarting the daemon, you update
the name service with current data.</para>
</listitem>
</itemizedlist>
</taskrelated>
</task><task id="rbactask-25"><title>How to Change the RBAC Properties
of a User</title><indexterm><primary>RBAC</primary><secondary>modifying users</secondary>
</indexterm><indexterm><primary>modifying</primary><secondary>users (RBAC)</secondary>
</indexterm><indexterm><primary>users</primary><secondary>modifying properties (RBAC)</secondary>
</indexterm><indexterm><primary>User Accounts tool</primary><secondary>description</secondary>
</indexterm><tasksummary><para>User properties include password, rights profiles, and authorizations.
The most secure method of giving a user administrative capabilities is to
assign a role to the user. For a discussion, see <olink targetptr="rbac-10" remap="internal">Security
Considerations When Directly Assigning Security Attributes</olink>.</para>
</tasksummary><taskprerequisites><para>You must have assumed the role of Primary Administrator or have switched
to superuser to change the properties of a user.</para>
</taskprerequisites><procedure remap="single-step"><step><para>Use one of the following methods to change the RBAC properties
of a user.</para><stepalternatives><step><para>Use the Users tool in the Solaris Management Console.</para><para>To
start the console, see <olink targetptr="rbactask-21" remap="internal">How to Assume a Role
in the Solaris Management Console</olink>. Follow the instructions in the
left-hand pane to modify a user in User Accounts. For more extensive information,
see the online help.</para><tip><para>It is not good practice to assign authorizations, privileges, or
rights profiles directly to users. The preferred approach is to assign a role
to users. Users then  assume a role to perform privileged operations.</para>
</tip>
</step><step><para><indexterm><primary><command>usermod</command> command</primary><secondary>changing user's RBAC properties</secondary></indexterm>Use the <command>usermod</command> command.</para><para>This command modifies the attributes
of a user that is defined in the local name service.</para><screen>$ usermod -R <replaceable>rolename</replaceable> <replaceable>username</replaceable></screen><variablelist><varlistentry><term><option>R</option> <replaceable>rolename</replaceable></term><listitem><para>Is the name of an existing local role.</para>
</listitem>
</varlistentry><varlistentry><term><replaceable>username</replaceable></term><listitem><para>Is the name of an existing, local user that you want to modify.</para>
</listitem>
</varlistentry>
</variablelist><para>For more command options, see the <olink targetdoc="group-refman" targetptr="usermod-1m" remap="external"><citerefentry><refentrytitle>usermod</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink> man page.</para>
</step><step><para><indexterm><primary><command>smuser</command> command</primary><secondary>changing user's RBAC properties</secondary></indexterm>Use the <command>smuser</command> command with the <command>modify</command> subcommand.</para><para>This command modifies the attributes of a user in a distributed name
service, such as NIS, NIS+, or LDAP. This command runs as a client of the
Solaris Management Console server.</para><screen>$ /usr/sadm/bin/smuser -D <replaceable>domain-name</replaceable> \ 
-r <replaceable>admin-role</replaceable> -l <replaceable>&lt;Type admin-role password&gt;</replaceable> \
modify -- -n <replaceable>username</replaceable> -a <replaceable>rolename</replaceable></screen><variablelist><varlistentry><term><option>D</option> <replaceable>domain-name</replaceable></term><listitem><para>Is the name of the domain that you want to manage.</para>
</listitem>
</varlistentry><varlistentry><term><option>r</option> <replaceable>admin-role</replaceable></term><listitem><para>Is the name of the administrative role that can modify the
role. The administrative role must have the <literal>solaris.role.assign</literal> authorization.
If you are modifying a role that you have assumed, the role must have the <literal>solaris.role.delegate</literal> authorization.</para>
</listitem>
</varlistentry><varlistentry><term><option>l</option></term><listitem><para>Is the prompt for the password of <replaceable>admin-role</replaceable>.</para>
</listitem>
</varlistentry><varlistentry><term><literal>--</literal></term><listitem><para>Is the required separator between authentication options and
subcommand options.</para>
</listitem>
</varlistentry><varlistentry><term><option>n</option> <replaceable>username</replaceable></term><listitem><para>Is the name of the user who is being assigned <replaceable>rolename</replaceable>.</para>
</listitem>
</varlistentry><varlistentry><term><option>a</option> <replaceable>rolename</replaceable></term><listitem><para>Is the name of the role that you are assigning to <replaceable>username</replaceable>. You can specify multiple <option>a</option> <replaceable>rolename</replaceable>options.</para>
</listitem>
</varlistentry>
</variablelist><para>For more command options, see the <olink targetdoc="group-refman" targetptr="smuser-1m" remap="external"><citerefentry><refentrytitle>smuser</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink> man page.</para>
</step>
</stepalternatives>
</step>
</procedure><example id="rbactask-53"><title>Modifying a Local User's RBAC Properties From the Command Line</title><para>In this example, the user <literal>jdoe</literal> can now assume the
role of System Administrator.</para><screen>$ <userinput>usermod -R sysadmin jdoe</userinput></screen>
</example><example id="rbactask-51"><title>Modifying a User's RBAC Properties With the <command>smuser</command> Command</title><indexterm><primary>RBAC</primary><secondary>changing user properties</secondary><tertiary>from command line</tertiary>
</indexterm><indexterm><primary>changing</primary><secondary>user properties from command line</secondary>
</indexterm><indexterm><primary>users</primary><secondary>changing properties from command line</secondary>
</indexterm><para>In this example, the user <literal>jdoe</literal> is assigned two roles,
System Administrator and Operator. Because the user and the roles are defined
locally, the <option>D</option> option is not necessary.</para><screen>$ <userinput>/usr/sadm/bin/smuser -r primaryadm -l</userinput> <replaceable>&lt;Type primaryadm password&gt;</replaceable> <userinput>\</userinput>
<userinput>modify -- -n jdoe -a sysadmin -a operadm</userinput></screen><para>In the following example, the user is defined in the NIS name service.
Therefore, the <option>D</option> option is required. Two roles are defined
in the name service. One role, <literal>root</literal>, is defined locally.</para><screen>$ <userinput>/usr/sadm/bin/smuser -D nis:/examplehost/example.domain \</userinput>
<userinput>-r primaryadm -l</userinput> <replaceable>&lt;Type primaryadm password&gt;</replaceable> <userinput>\</userinput>
<userinput>modify -- -n jdoe -a sysadmin -a operadm -a root</userinput></screen>
</example>
</task><task id="rbactask-26"><title>How to Add RBAC Properties to Legacy
Applications</title><indexterm><primary>adding</primary><secondary>RBAC properties to legacy applications</secondary>
</indexterm><indexterm><primary>adding</primary><secondary>security attributes to legacy applications</secondary>
</indexterm><tasksummary><para>A legacy application is a command or set of commands. The security attributes
are set for each command in a rights profile. The rights profile is then included
in a role. A user who assumes the role can run the legacy application with
the security attributes.</para><para>To add legacy applications to the Solaris Management Console, see <olink targetdoc="group-sa" targetptr="smcover-118" remap="external"><citetitle remap="section">Adding Tools to the Solaris Management Console</citetitle> in <citetitle remap="book">System Administration Guide: Basic Administration</citetitle></olink>.</para>
</tasksummary><taskprerequisites><para>You must have assumed the role of Primary Administrator or have switched
to superuser to change the security attributes of a command in a rights profile.</para>
</taskprerequisites><procedure><step><para>Use the Users tool in the Solaris Management Console.</para><para>To
start the console, see <olink targetptr="rbactask-21" remap="internal">How to Assume a Role
in the Solaris Management Console</olink>. Follow the instructions in the
left-hand pane to modify a rights profile in Rights. For more extensive information,
see the online help.</para>
</step><step><para>Add security attributes to the commands that implement the legacy
application.</para><para>You add security attributes to a legacy application
in the same way that you would for any command. You must add the command with
security attributes to a rights profile. For a legacy command, give the command <literal>euid=0</literal> or <literal>uid=0</literal> security attributes. For details
of the procedure, see <olink targetptr="rbactask-24" remap="internal">How to Create or Change
a Rights Profile</olink>.</para>
</step><step><para>After adding the legacy application to a rights profile, include
the rights profile in a role's list of profiles.</para><para>To add a rights
profile to a role, see <olink targetptr="rbactask-23" remap="internal">How to Change the Properties
of a Role</olink>.</para>
</step>
</procedure><example id="rbactask-55"><title>Adding Security Attributes to Commands in a Script</title><para><indexterm><primary>RBAC</primary><secondary>securing scripts</secondary></indexterm><indexterm><primary>scripts</primary><secondary>securing</secondary></indexterm><indexterm><primary>securing</primary><secondary>scripts</secondary></indexterm>If a command in a script needs to have the <command>setuid</command> bit
or <command>setgid</command> bit set to succeed, the script executable <emphasis>and</emphasis> the command must have the security attributes added in a rights
profile. Then, the rights profile is included in a role, and the role is assigned
to a user. When the user assumes the role and executes the script, the command
runs with the security attributes.</para><para>To add security attributes to a command or shell script, see <olink targetptr="rbactask-24" remap="internal">How to Create or Change a Rights Profile</olink>.</para>
</example><example id="rbactask-12"><title>Checking for Authorizations in a Script or Program</title><para><indexterm><primary>RBAC</primary><secondary>checking scripts or programs for authorizations</secondary></indexterm><indexterm><primary>scripts</primary><secondary>checking for RBAC authorizations</secondary></indexterm><indexterm><primary>programs</primary><secondary>checking for RBAC authorizations</secondary></indexterm>To have a script for authorizations, you need to add a test that
is based on the <command>auths</command> command. For detailed information
about this command, see the <olink targetdoc="group-refman" targetptr="auths-1" remap="external"><citerefentry><refentrytitle>auths</refentrytitle><manvolnum>1</manvolnum></citerefentry></olink> man
page.</para><para>For example, the following line tests if the user has the authorization
that is supplied as the <literal>$1</literal> argument:</para><screen>if [ `/usr/bin/auths|/usr/xpg4/bin/grep $1` ]; then
        echo Auth granted
else
        echo Auth denied
fi</screen><itemizedlist><para><indexterm><primary>* (asterisk)</primary><secondary>checking for in RBAC authorizations</secondary></indexterm><indexterm><primary>asterisk (*)</primary><secondary>checking for in RBAC authorizations</secondary></indexterm><indexterm><primary>authorizations (RBAC)</primary><secondary>checking for wildcards</secondary></indexterm>To be more complete, the test should include logic that checks
for other authorizations that use wildcards. For example, to test if the user
has the <literal>solaris.admin.usermgr.write</literal> authorization, you
would need to check for the following strings:</para><listitem><para><literal>solaris.admin.usermgr.write</literal></para>
</listitem><listitem><para><literal>solaris.admin.usermgr.*</literal></para>
</listitem><listitem><para><literal>solaris.admin.*</literal></para>
</listitem><listitem><para><literal>solaris.*</literal></para>
</listitem>
</itemizedlist><para>If you are writing a program, use the function <function>getauthattr</function> to
test for the authorization.</para>
</example>
</task>
</sect1>
</chapter><?Pub *0000112618 0?>