This question already has an answer here:

I have tried creating a user through command line with sudo adduser user but when I log in using that user's credential I get some error saying user is not in sudoers file. How can I add new user to sudoers file?

marked as duplicate by Community Dec 26 '18 at 9:24

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


How can I add new user to sudoers file?

If you wish to create a user with sudo privilege, execute,

sudo adduser --ingroup sudo <username>

If you wish to add an existing user, execute

sudo usermod -aG sudo <username>

Not the answer you're looking for? Browse other questions tagged or ask your own question.