Steps to add the username as Sudo user in Ubuntu or Linux
- Login with the root user.
su root
Password: enterrootpassword
2. Install sudo from root user if not present
apt-get install sudo -y
3. Use the following command to add your username as sudo user:
adduser <username> sudo
4. Exit
Test the user got sudo privileges by logout from current user and login switch the user in terminal by su command:
Switch the user in terminal or logout and login with username for testing the sudo command is working as:
sudo apt-get update