Create an account in the Linux environment and give sudo permissions
1. View the kernel version of the Linx virtual machine
lsb_release -a
Distributor ID: Ubuntu Description: Ubuntu 18.04.2 LTS Release: 18.04 Codename: bionic
Create a new user:
#adduser username
set password:
passwd username
Press Enter, enter the new password and confirm the password;
Authorize sudo permissions
1. First find the location of the file. In the example, the file is in the /etc/sudoers location.
whereis sudoers
2. Modify file permissions. Generally, files are read-only by default.
ls -l /etc/sudoers
3. View file permissions
chmod -v u+w /etc/sudoers
4. Modify file permissions to be editable
5. Modify the file, add a line in the following position and save;
vim /etc/sudoers
The contents of the file are changed as follows:
# User privilege specification
root ALL=(ALL:ALL) ALL (already)
admin ALL=(ALL:ALL) ALL (new)
6. Restore file permissions back to read-only.
ls -l /etc/sudoers
chmod -v u-w /etc/sudoers
Finally, open a new interface and try to log in with the newly created account!