Theme images by kelvinjay. Powered by Blogger.

RHEL

HTML

MCSA

HACKING & TRICKS

» » How to Add a New User in Linux


1. How to Add a New User in Linux


To add/create a new user, all you’ve to follow the command ‘useradd‘ or ‘adduser‘ with ‘username’. The ‘username’ is a user login name, that is used by user to login into the system.

Only one user can be added and that username must be unique (different from other username already exists on the system).
For example, to add a new user called ‘itims‘, use the following command.

[root@nikunj ~]# useradd itims

When we add a new user in Linux with ‘useradd‘ command it gets created in locked state and to unlock that user account, we need to set a password for that account with ‘passwd‘ command.

[root@nikunj ~]# passwd itims
Changing password for user itims.
New UNIX password:
Retype new UNIX password:
passwd: all authentication tokens updated successfully.

Once a new user created, it’s entry automatically added to the ‘/etc/passwd‘ file. The file is used to store users information and the entry should be.

itims:x:504:504:tecmint:/home/itims:/bin/bash

The above entry contains a set of seven colon-separated fields, each field has it’s own meaning. Let’s see what are these fields:
  1.   Username: User login name used to login into system. It should be between 1         to 32 charcters long.
2.   Password: User password (or x character) stored in /etc/shadow file in encrypted format.

3.   User ID (UID): Every user must have a User ID (UID) User Identification Number. By default UID 0 is reserved for root user and UID’s ranging from 1-99 are reserved for other predefined accounts. Further UID’s ranging from 100-999 are reserved for system accounts and groups.

4.   Group ID (GID): The primary Group ID (GID) Group Identification Number stored in /etc/group file.

5.   User Info: This field is optional and allow you to define extra information about the user. For example, user full name. This field is filled by ‘finger’ command.

6.   Home Directory: The absolute location of user’s home directory.

7.   Shell: The absolute location of a user’s shell i.e. /bin/bash.

«
Next
Newer Post
»
Previous
Older Post

2 comments:

  1. and squandered framework assets on designs handling. Different appropriations, for example, Suse attempt to settle on some mutual interest between convenience and configurability. https://onohosting.com/

    ReplyDelete

How To Configure YUM Server and Client In RHEL 7 ...!!!

How To Configure YUM Server and Client In RHEL 7 ...!!! Yum Server Configuring Yum server IP = 192.168.0.1 Yum server hostname = s...