How to add user

less than 1 minute read

How to add user

  1. Check an user exists
    $ cat /etc/passwd | grep testuser
    
  2. Set home directory and shell env
    • Ubuntu, SUSE
      $ useradd <username> -m -s /bin/bash
      

      -> -m option should be declared to make home directory -> -s /bin/bash option should be declared set shell env

    • CentOS
      $ useradd <username>
      

      -> CentOS or Redhat linux don’t need to option for home directory and shell env

  3. Make user with giving a group
    $ useradd <username> -G <groupname>
    
  4. Make user with UID An UID is number
    $ useradd <username> -u <uid>
    

Categories:

Updated:

Leave a Comment