(originally published on 11.04.2013, reviewed/rewritten on 26.04.2025, tested on Oracle Solaris 11.4 SRU 80)
 

The useradd tool in Solaris has the capability to use some defaults.

If you want to see the current defaults, you can do this via using useradd -D:

root@testbed:~# useradd -D 
group=staff,10  project=default,3  basedir=/export/home  
skel=/etc/skel  shell=/usr/bin/bash  inactive=0  
expire=  auths=  roles=  profiles=  limitpriv=  
defaultpriv=  lock_after_retries=  roleauth=  
auth_profiles=  clearance=  min_label=  pam_policy=  
project=  audit_flags=  access_times=  access_tz=  
unlock_after=  tpd=  annotation=  zfshome=yes  

Let’s assume you have a group admins and you want to put all new users created by useradm into this group. You use the -D option again.

root@testbed:~# useradd -D -g admins
group=admins,100  project=default,3  basedir=/export/home  
skel=/etc/skel  shell=/usr/bin/bash  inactive=0  
expire=  auths=  roles=  profiles=  limitpriv=  
defaultpriv=  lock_after_retries=  roleauth=  
auth_profiles=  clearance=  min_label=  pam_policy=  
project=  audit_flags=  access_times=  access_tz=  
unlock_after=  tpd=  annotation=  zfshome=yes  

Do you want to learn more?

docs.oracle.com: man page of useradd(1m)

Written by

Joerg Moellenkamp

Grey-haired, sometimes grey-bearded Windows dismissing Unix guy.