2.6 Adding a sudo user

We are adding a new user called jimmy. Our new server has already given us a sudo user but some Linux distributions may log you in as root. This command assumes you have logged in as ubuntu, a sudo user.

sudo adduser jimmy

Set password prompts:
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully

Password is entered twice. Make sure it is strong. The other details can be folled in or skiped.

User information prompts:
Changing the user information for username
Enter the new value, or press ENTER for the default
Full Name []:
Room Number []:
Work Phone []:
Home Phone []:
Other []:
Is the information correct? [Y/n] Y

Run the cooamnd **sudo usermod -aG sudo jimmy**
ubuntu@vds2:~$ sudo usermod -aG sudo jimmy
ubuntu@vds2:~$ su jimmy
Password:
To run a command as administrator (user "root"), use "sudo ".
See "man sudo_root" for details.
jimmy@vds2:/home/ubuntu$

The command **su jimmy** sets the user to jimmy. Notice how the prompt changes. From now on we will log in as jimmy and use sudo to run commands as administrator.

In Ubuntu the logging on as root is strongly discouraged. We are creating a new user (jimmy). The user ubuntu is not root so we add sudo before the command, The user jimmy is then given sudo privileges.

From now on, never log in as root. Always use your new user and sudo to carry out any admin procedures.

No comments:

Post a Comment

Introduction to Linux Command Line

SSH is the way you will connect to your Linux server. You will need to understand the basics of the Linux Command Line.