Go to main content

man pages section 1M: System Administration Commands

Exit Print View

Updated: July 2017



rolemod - modify a role's login information on the system


rolemod [-u uid [
-o]] [-g group] [
-G [+|-]group [, group...]] 
     [-d dir [-m]] [
-s shell] [-c 
comment] [-l new_name] 
     [-f inactive] [-e 
     [-A [+|-]authorization [, 
     [-S repository]
     [-P [+|-]profile [, 
profile]] [-K key[+|-]=
value][-q qualifier] role


The rolemod utility modifies a role's login information on the system. It changes the definition of the specified login and makes the appropriate login-related system file and file system changes.

The system file entries created with this command have a limit of 512 characters per line. Specifying long arguments to several options may exceed this limit.

An administrator must be granted the User Security Profile to be able to modify the security attributes for an existing role. To be able to modify non-security attributes of an existing user requires the User Management Profile. The authorizations required to set the various fields in passwd, shadow and user_attr can be found in passwd(4), shadow(4), user_attr(4). The authorizations required to assign groups can be found in group(4).


The following options are supported:

–A [+|]authorization

One or more comma separated authorizations as defined in auth_attr(4). Only role with grant rights to the authorization can assign it to an account. This replaces any existing authorization setting. If no authorization list is specified, the existing setting is removed.

A prefix + adds the authorization to the existing authorization; a prefix - removes the authorization from the existing authorization. With no prefix, the value for authorization replaces the existing authorization.

–c comment

Specify a comment string. comment can be any text string. It is generally a short description of the login, and is currently used as the field for the user's full name. This information is stored in the user's /etc/passwd entry.

–d dir

Specify the new home directory of the role. It defaults to base_dir/login, where base_dir is the base directory for new login home directories, and login is the new login. This creates or modifies an auto_home entry for the user.

The argument to the option can be specified as server: dir where server is the hostname of the machine on which the home directory resides and dir is the path to the user's home directory. If the server is a remote host then the home directory needs to be created on the remote host for the system to mount it, when the user logs in. If no server name is specified then the home directory will be created on the host where the command is executed, when the –m option is used.

–e expire

Specify the expiration date for a role. After this date, no role will be able to access this login. The expire option argument is a date entered using one of the date formats included in the template file /etc/datemsk . See getdate(3C).

For example, you may enter 10/6/90 or October 6, 1990. A value of `` '' defeats the status of the expired date.

–f inactive

Specify the maximum number of days allowed between uses of a login ID before that login ID is declared invalid. Normal values are positive integers. A value of 0 defeats the status.

–g group

Specify an existing group's integer ID or character-string name. It redefines the role's primary group membership.

–G [+|-]group

An existing group's integer ID or character-string name. It defines the new user's supplementary group membership. Duplicates between group with the –g and –G options are ignored. No more than NGROUPS_MAX groups can be specified. GIDs 0-99 are reserved for allocation by the Solaris Operating System.

A prefix + adds the group to the existing group; a prefix -removes the group from the existing group. With no prefix, group replaces the existing group.

–K key[+|-]= value

Replace existing or add to a role's key=value pair attributes. Multiple –K options can be used to replace or add multiple key=value pairs. However, keys must not be repeated. The generic –K option with the appropriate key may be used instead of the specific implied key options (–A and – P). See user_attr(4) for a list of valid key=value pairs. If no value is specified, the existing key is removed.

The keyword type can be specified with the value role or the value normal. When using the value normal, the account changes from a role user to a normal user; using the value role keeps the account a role user.

A prefix + adds the value to the existing value; a prefix - removes the value from the existing value. With no prefix, value replaces the existing value.

The prefix +/- operation is applicable only to the following keys: auths, profiles, roles, project, limitpriv, defaultpriv, auth_profiles, and access_times .

–l new_logname

Specify the new login name for the role. The new_logname argument is a string no more than eight bytes consisting of characters from the set of alphabetic characters, numeric characters, period (.), underline (_), and hypen (). The first character should be alphabetic and the field should contain at least one lower case alphabetic character. A warning message will be written if these restrictions are not met. A future Solaris release may refuse to accept login fields that do not meet these requirements. The new_logname argument must contain at least one character and must not contain a colon (:) or NEWLINE ( \n).


Move the role's home directory to the new directory specified with the –d option. If the directory already exists, it must have permissions read/write/execute by group, where group is the role's primary group. If the server name specified to the –d option is a remote host then the system will not attempt to create the home directory.

If the directory does not already exist, a new ZFS dataset will be created. In the global zone, the dataset is created as rpool/export/home/ rolename. For non-global zones, the dataset will be created as ROOT-dataset/export/home/ rolename. The mountpoint for the ZFS dataset is /export/home/ rolename by default. If –d path is specified and it is a path on the local machine, the dataset will be mounted at the specified location. The role is delegated permissions to create ZFS snapshots and promote them. The newly created dataset will inherit the encryption setting from its parent. If it is encrypted, the role is granted permission to change its wrapping key.


This option allows the specified UID to be duplicated (non-unique).

–P [+|-]profile

One or more comma-separated execution profiles defined in auth_attr(4). This replaces any existing profile setting. If no profile list is specified, the existing setting is removed.

A prefix + adds the profile to the existing profile; a prefix - removes the profile from the existing profile. With no prefix, profile replaces the existing profile.

–q qualifier

The name of a host or netgroup which qualifies where the extended attributes (specified through -K, -P, -A, and + -R) are applicable. The prefix @ is required to indicate that the qualifier is a netgroup name. The –q option is only valid if the user account is maintained in the LDAP name service.

–s shell

Specify the full pathname of the program that is used as the role's shell on login. The value of shell must be a valid executable file.

–S repository

The valid repositories are files, ldap . The repository specifies which name service will be updated. The default repository is files. When the repository is files , the authorizations, profiles, and roles can be present in other name service repositories and can be assigned to a user in the files repository. When the repository is ldap, all the assignable attributes must be present in the ldap repository.

–u uid

Specify a new UID for the role. It must be a non-negative decimal integer less than MAXUID as defined in <param.h>.


The following operands are supported:


An existing login name to be modified.


Example 1 Setting Root Back to a Normal Account

The following command sets the root user back to a normal, non-privileged user.

# rolemod -K type=normal root
Found user in files repository.

Exit Status

In case of an error, rolemod prints an error message and exits with one of the following values:


No permission for attempted operation.


The command syntax was invalid. A usage message for the usermod command is displayed.


An invalid argument was provided to an option.


The gid or uid given with the –u option is already in use.


The password and shadow files are not consistent with each other. pwconv(1M) might be of use to correct possible errors. See passwd(4) and shadow(4).


The login to be modified does not exist, the gid or the uid does not exist.


The group, passwd, or shadow file is missing.


A group or user name is already in use.


Cannot update the passwd, shadow, or user_attr file.


Insufficient space to move the home directory (–m option).


Unable to create, remove, or move the new home directory.


Requested login is already in use.


Unexpected failure.


Unable to update the group database.


Unable to update the project database.


Insufficient authorization.


Does not have role.


Does not have profile.


Does not have privilege.


Does not have label.


Does not have group.


System not running Trusted Extensions.


Does not have project.


Unable to update auto_home.



system file containing group definitions


system file of date formats


system password file


system file containing users' and roles' encrypted passwords and related information


system file containing additional user and role attributes


See attributes(5) for descriptions of the following attributes:

Interface Stability

See Also

auths(1), chown(1), passwd(1), profiles(1), users(1B), groupadd(1M), groupdel(1M), groupmod(1M), logins(1M), pwconv(1M), roleadd(1M), roledel(1M), useradd(1M), userdel(1M), usermod(1M), getdate(3C), auth_attr(4), group(4), passwd(4), shadow(4), user_attr(4), attributes(5)