Management User Solaris
Create a local user.
By default, the user is created locally. If you include the –S ldap option, the user is created in an existing LDAP repository.
# useradd -d dir -m username
- –d
- Specifies the location of the home directory of the user
Use the –d localhost:/export/home/username instead of –d /export/home/username to force the entry to be written to auto_home.
- –m
- Creates a local home directory on the system for the user.
Assign the user a password.
# passwd username New password: Type user password Re-enter new password: Retype password
Modify the user account, as required.
For example, to add a role to a user, you would type:
# usermod -R role username
# usermod -K pam_policy=krb5_only jdoe
How to Unlock a User Account
- Check the status of the user account that you need to unlock.
$ passwd -s username username LK
- Unlock the user account.
$ passwd -u username passwd: password information changed for username
- Check if the desired user account has been unlocked.
$ passwd -s username PS
How to Delete a User
- Become an administrator.
$ su - Password: #
Note – This method works whether root is a user account or a role.
- Archive the home directory of the user.
- Delete the user.
# userdel -r username
The –r option removes the account from the system.
The preferred method for removing a local home directory for a deleted user is to specify the –r option with the userdel command. This method is preferred because user home directories are now ZFS datasets.
- If the user’s home directory is on a remote server, manually delete it.
# userdel username
How to Add a Group
When an administrator creates a group, the system assigns the solaris.group.assign/groupname to that administrator, giving the administrator complete control over that group. If another administrator who has the same authorization creates a group, that administrator has the control over that group. An administrator who has control of one group cannot administer the group of the other administrator.
- List the existing groups.
# cat /etc/group
- Create a new group.
$ groupadd -g group-id group-name
- –g
- Assigns the group ID for the new group
Example 4 Setting Up a Group and User With the groupadd and useradd Commands
The following example shows how to use the groupadd and useradd commands to add the group scutters and the user scutter1 to files on the local system.
# groupadd -g 102 scutters # useradd -u 1003 -g 102 -d /export/home/scutter1 -s /bin/csh \ -c "Scutter 1" -m -k /etc/skel scutter1 64 blocks