Showing posts with label useradd command in Linux. Show all posts
Showing posts with label useradd command in Linux. Show all posts

User management commands in linux

linux commands for begginers

How to add user in linux?

In Linux, a ‘useradd‘ command is a low-level utility that is used for adding/creating user accounts in Linux and other Unix-like operating systems. 
Let the new user to be add is Testuser ,then the command will be :
useradd Testuser

Creating password for a user :
passwd Testuser

Enter the new password for the user.

We can see this user details in /etc/passwd file.
cat /etc/passwd

When we run ‘useradd‘ command in Linux terminal, it performs following major things:
  1. It edits /etc/passwd, /etc/shadow, /etc/group and /etc/gshadow files for the newly created User account.
  2. Creates and populate a home directory for the new user.
  3. Sets permissions and ownership to home directory.
    The default home directory for a user will be  ‘ /home/Testuser/ ‘ . but we can create a user with different home directory.
    useradd –d [directory] Testuser
    

    Author : 
    Ajith Michael
    System Engineer
    Bayasys Infotech (P) Ltd., Kochi.

    Image source : www.google.com