Even if the knowledge is insignificant for an engineer who can do it, I would like to acquire the habit of transmitting it first.
· MacOS Mojave 10.14 -Linux OS built in the virtual machine [Virtual Box] ・ CentOs7
sudo command Commands that allow you to use commands with root privileges
First, log in as the root user and create a user with the useradd command.
Name: testUser01
It is essential to set a password so that the created user can log in. Set the password for testUser01 with the command "passwd" that sets the password.
Now you are ready to log in as a regular user (= testUser01).
Now, let's try logging in as a general user and use the sudo command to view log files that cannot be viewed with user privileges. cat var/log/messages
When I was asked for the password and typed it in as I was told, I was told that the user is not in the sudoers file.
This is because, as it was said, the sudoers file does not contain general user settings in the sudoers file.
To resolve this, do the following:
-Make general users belong to the wheel group. In CentOS7, "wheel group" is allowed to execute all commands.
Log in as the root user once, Let's add a general user to the wheel group with the "usermod" command that changes the user definition.
You can check if a user has been added to the wheel group with the vigr command.
-Set the sudoers file Use the [visudo] command to add the settings for general users. Next, let's enable the definition of the wheel group with the visudo command.
% wheel ALL = (ALL) Uncomment the ALL and enable the option.
Save with esc →: wq and try the sudo command again.
Command description because it is not visible on the screen cat /vat/log/messages
The sudo command is now available and you can see the contents of the log file!