Tuesday, January 20, 2015

How to add user in Linux



This is a small “how-to” on adding users in Linux. As Linux is multi-user supporting operating system so that multiple users can login symeltiniously login and do their job. Linux administrators some time require to create user accounts for a project so that the users can login to the machine and work on it. This can be accomplished by executing adduser linux command from terminal. This command will create user accounts with normal privileged access and with default settings such as home directories, type of the shell, UID and GID as well. Only root user can execute adduser command. If a normal user want to create accounts in the system he should be granted access by root user for sudo access for adduser command.

Step1: Add user account with following command

adduser user-name
or
useradd user-name

Example:

adduser rajesh
or
useradd rajesh

Note: There is one more command useradd which will work similarly as adduser command.

Step2: Set password for this user so that he can login to the machine. If this step is missed user can not login to this machine.

passwd username

Example:

passwd rajesh
passwd ******
confirm passwd ******

Step3: Check if the user account is created successfully or not

grep rajesh /etc/passwd
or
tail /etc/passwd
This command should show you a line contain about user:rajesh details.

No comments:

Post a Comment