Solaris adding new user accounts

useradd command use to add a new user to the /etc/passwd and /etc/shadow and /etc/user_attr file. Before adding a new user you need to setup defaults by specifying useradd -D with the combination of options which sets the default values for the respective fields. So that Subsequent useradd commands without the –D option use these arguments. It will save your time.

# useradd -D -b /export/home -g pusers

Output:

group=pusers,100  project=default,3  basedir=/export/home
skel=/etc/skel  shell=/bin/sh  inactive=0
expire=  auths=  profiles=  roles=  limitpriv=
defaultpriv=  lock_after_retries=

Where,

  • -b : Base home directory
  • -g : Primary group

Now add a user rockyjr:

# useradd -m rockyjr
# passwd -f rockyjr

Where,

  • -m : creates a home directory for rockyjr user.
  • -f : The -f option expires the password at first login, forcing the rockyjr to change it

Common option for useradd command

  • -u 1030 : Use UID 101
  • -g pusers : Specify user’s primary login group
  • -G ftp,admin,www : Specify user’s secondary group membership
  • -d /nas/home/user : Specify user’s home directory
  • -s /usr/bin/bash : Specify user’s login shell

🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 1 comment so far... add one


CategoryList of Unix and Linux commands
Disk space analyzersdf duf ncdu pydf
File Managementcat cp mkdir tree
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Modern utilitiesbat exa
Network UtilitiesNetHogs dig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg glances gtop jobs killall kill pidof pstree pwdx time vtop
Searchingag grep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
1 comment… add one
  • Thilak Jul 25, 2013 @ 8:18

    Good Info. Saved my time 🙂
    Thanks !

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Still have questions? Post it on our forum