When you create a new Ubuntu server in the cloud, by default you get the root account. This account has full system access with no restrictions at all and should only be used for administrative tasks. You can always create a new user account with fewer privileges. But there are times when you need extra root privileges to add a new user or change some system setting. You can use the sudo command to temporarily get extra privileges for a single command. In this recipe, you will see how to grant sudo privileges to a newly created user.
You will need a root account or an account with root privileges. Follow these steps to get the root privileges with sudo.
Step 1 : Add new user if required
sudo adduser tutorial
Step 2 : Make john a member of sudo group with the following command.
# sudo adduser <username> sudo sudo adduser tutorial sudo