How to use useradd to create and administer users under Linux

Written by
Date: 2012-11-29 11:43:32 00:00


This is a command all Linux administrators should know, because they are the people in charge of creating users accounts, this will be one of three different posts about managing users.

useradd, creates a new user or update default new user information.

Syntax:

useradd [options] LOGIN

Some of its options are:

  • -d home directory
  • -s starting program (shell)
  • -p password
  • -g (primary group assigned to the users)
  • -G (Other groups the user belongs to)
  • -m (Create the user's home directory

Example

useradd -g primary_grp -G admin -s /bin/shell -p xxxx -d /home/user -m user