CentOS: how to create sudo user


Example we create new user with username is tutorialspots:

Step 1:

useradd tutorialspots

Step 2:
Set password with command: passwd

[root@tutorialspots ~]# passwd tutorialspots
Changing password for user tutorialspots.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.

Step 3:
Edit file /etc/sudoers:
visudo or sudo vi /etc/sudoers

Add this line:

tutorialspots    ALL=(ALL)       ALL

Done!

Note: if you use command you might get warning:

-- INSERT -- W10: Warning: Changing a readonly file

2 Comments

Leave a Reply