I usually work as root، no problem.
But some recommend that to work as user (For security reasons).
But they do not mention what problems you will face in this case.
These are the things I did.
I tried to create a username with adduser.
adduser USERNAME
su USERNAME
sudo true
And then I got this message:
sudo: unable to resolve host localhost: Name or service not known
[sudo] password for USERNAME:
USERNAME is not in the sudoers file. This incident will be reported.
In the last step, you may have noticed a warning: sudo: unable to resolve host localhost: Name or service not known To fix this, I entered this command:
echo "127.0.0.1 localhost.localdomain localhost" > /etc/hosts
And it worked.
Then I used this for the second message:
adduser USERNAME sudo
Adding user `USERNAME' to group `sudo' ...
Adding user USERNAME to group sudo
Done.
The problem must have been solved. right!?
su USERNAME
cd
sudo true
[sudo] password for USERNAME:
USERNAME is not in the sudoers file. This incident will be reported.
But as you can see, the problem was not solved with the second message
adduser USERNAME sudo
The user `USERNAME' is already a member of `sudo'.
Now how do I solve this problem?