User Creation and Remove commands in solaris 10

Creating User Accounts

To create a user account:

# useradd -u 100 -g other -d /export/home/newuser1 -m -s /bin/ksh -c
"Regular User Account" newuser1

# passwd newuser1


# /usr/sadm/bin/smuser add -- -n newuser2 -u 500 -g other -d
/export/home/newuser2 -c "Regular User Account 2" -s /bin/ksh -x
autohome=N

# passwd newuser2


Modifying User Accounts


To change the login name and home directory for newuser1 to usera.

# usermod -m -d /export/home/usera -l usera newuser1

To change the login name and home directory for newuser2 to userb.

# /usr/sadm/bin/smuser modify -- -n newuser2 -N userb -d /export/home/userb



Deleting User Accounts
# userdel usera        ==> to remove the user account

# userdel -r usera    ==> to remove both the users account & home directory


# /usr/sadm/bin/smuser delete -- -n userb    ==> the users home directory                             should be deleted manually


Creating a Group Entry
# groupadd -g 301 class1

# /usr/sadm/bin/smgroup add -- -n workgroup -g 123 -m usera


Modifying a Group Entry
# groupmod -g 400 class1    ==> to change group ID

To change group name
# /usr/sadm/bin/smgroup modify -- -n workgroup -N schoolgroup


Deleting a Group Entry
# groupdel class1

# /usr/sadm/bin/smgroup delete -- -n schoolgroup



# vi /etc/default/passwd    ==> to control the properties for all users’
                    passwords on the system:


# ls -l /usr/sadm/defadduser    ==> to display default values for useradd
                    command

# useradd -D

# cat /usr/sadm/defadduser