Tuesday, April 21, 2015

How to add user in ubuntu 14.04

    Have you try to create new user in ubuntu? To do that you have to log as root user (super user). By default, the Root account password is locked in Ubuntu and you will not able to login as Root directly or use the su command to become the Root user. The root user doesn't have a password set. The steps to enable the root account is very simple. But it is not recommended because it may cause very serious trouble to your system because login as Root means you can do anything

type below command

sudo passwd root

Issue this command to enable root login on Ubuntu 14.04. You will prompted for a new Unix password. Second password for confirmation




Then type below command to change your login as root. After that you will prompt to provide the password

su root


Then we are ready to add a new user. Type below command

adduser username

add user name  to username field.
Then you will prompt to provide details about the new user.
You can fill them or you can skip it by pressing Enter



If your new user should have the ability to execute commands with root (administrative) privileges, you will need to give the new user access to sudo. We can do this by using the visudo command, which opens the appropriate configuration file in your editor. This is the safest way to make these changes.

If you are currently signed in as the root user, type

visudo

Search for the line that looks like this

root    ALL=(ALL:ALL) ALL

Below this line, copy the format you see here, changing only the word "root" to reference the new user that you would like to give sudo privileges to

root    ALL=(ALL:ALL) ALL
newuser ALL=(ALL:ALL) ALL



You should add a new line like this for each user that should be given full sudo privileges. When you are finished, you can save and close the file by hitting CTRL-X, followed by "Y", and then hit "ENTER" to confirm.

Now, your new user is able to execute commands with administrative privileges.

if you want to exit from root to normal login you can type simply

exit

or

su username

Anyway you can create users using sudo command as usual but I here create users, by login as the root because in ubuntu we don't do it generally.

No comments:

Post a Comment