In this article will show you how to add a user in Oracle Solaris 11. You can add a new user by using a “useradd” command which will create an account for the specified user. After you create a new user, you should assign a password for that user to make it active or till then that user will be in a locked state. Therefore I will always prefer to assign password immediately after you create a new user. You can find the same from below commands too.
There are lots of command options you can specific while creating a new user in Oracle Solaris 11. For example, “-d” option will help you to create user’s home directory, “-m” option will make the home directory with copying the skeleton files, “-u” option will be used for userid, if you do not specify it while creating a new user, then it will automatically assign the next available userid for that user and “-s” option is to assign which shell to use by user whether it may be a bash or kshell, by default it will use /bin/sh.
Useradd command syntax:
#useradd –d /export/home/<username> -s /bin/bash –m <username>
Adding a user in Oracle Solaris 11
1) As a first step, you need to log in as a root user and continue with the below commands to perform the same successfully.
Here I am using <username> as <testuser>
2) Create a new user
#useradd –d /export/home/testuser –s /bin/bash –m testuser
3) Create a password for “testuser” to make it active
Changing password for user testuser.
Retype new password:
passwd: all authentication tokens updated successfully.
Now you have successfully created a new password for the “testuser”. It got activated and now you can login with testuser without any issue.s
4) You can check whether it got updated in /etc/passwd file by running the below command
# more /etc/passwd | grep testuser
Note: I have not specified UID while creating a new user, but it assigns the available UID automatically as “505”.
5) Also, you can check whether it got updated in /etc/shadow file by running the below command
# more /etc/shadow | grep testuser
Note: It will show you the encrypted password as “eAajc2xT$ft0Pnhny6akqf2/rTmdiyMyjb1uJYD8qQpsatTqAMwngVjkVwD/YTNmzp7684NecaeKNRTQWQ/w5gJBwPVfcq0”
6) Also, you can use password check command “pwck” if you did any changes in user, for example, adding to new group or changing the password. So if you run password check command it will make sure whether its properly sync with the default files where the user and password exist.
pwck: no changes
7) See also man page for more command options with “useradd”
So in this article, you have learned how to add a new user with password and do password check if you do any changes to that user and its properly synced with the default files like /etc/shadow, /etc/passwd and /etc/group.
If you find this post is useful/helpful, please follow, like and share. Thank you for visiting my blog!!!