Thứ Sáu, 26 tháng 2, 2016

How to Add a User and Grant Root Privileges on Ubuntu 14.04

Pre-Flight Check

  • These instructions are intended specifically for adding a user on Ubuntu 14.04 LTS.
  • I’ll be working from a Liquid Web Core Managed Ubuntu 14.04 LTS server, and I’ll be logged in as root.

Step 1: Add the User

It’s just one simple command to add a user. In this case, we’re adding a user called madman:

adduser madman
First you will be prompted to enter the user’s password (twice); do this step. Next you’ll be prompted to enter in the user’s information. This step is not required, and pressing enter fills the field with the default information:

Adding user 'madman' ...
Adding new group 'madman' (1001) ...
Adding new user 'madman' (1001) with group 'madman' ...
Creating home directory '/home/madman' ...
Copying files from '/etc/skel' ...
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
Changing the user information for madman
Enter the new value, or press ENTER for the default
Full Name []: User
Room Number []:
Work Phone []:
Home Phone []:
Other []:
When prompted with the following question, enter Y then hit enter to continue.

Is the information correct? [Y/n] Y

Step 2: Grant Root Privileges to the Use

visudo
Find the following code:

# User privilege specification
root ALL=(ALL:ALL) ALL
In this case, we’re granting root privileges to the user madman. Add the following below that code:

madman ALL=(ALL:ALL) ALL
Then exit and save the file with the key commands Ctrl-x, Y, enter.
If you’ve followed the instruction above correctly, then you should now have a user setup by the name of madman which can use sudo to run commands as root!

Không có nhận xét nào:

Đăng nhận xét