Notes – Add a Sudo User on CentOS

adduser centos7_user
passwd centos7_user
usermod -aG wheel centos7_user
[root@centos7 ~]# adduser centos7_user
[root@centos7 ~]#
[root@centos7 ~]# passwd centos7_user
Changing password for user centos7_user.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.
[root@centos7 ~]#
[root@centos7 ~]# usermod -aG wheel centos7_user
[root@centos7 ~]#

************** Test sudo access on new user account **************

[root@centos7 ~]# su - centos7_user
[centos7_user@centos7 ~]$
[centos7_user@centos7 ~]$ sudo ls -la /root

We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:

    #1) Respect the privacy of others.
    #2) Think before you type.
    #3) With great power comes great responsibility.

[sudo] password for centos7_user:
total 28
dr-xr-x---.  2 root root  135 Jul 16 23:25 .
dr-xr-xr-x. 17 root root  224 Jul 15 22:04 ..
-rw-------.  1 root root 1403 Jul 15 22:04 anaconda-ks.cfg
-rw-------.  1 root root  178 Jul 16 23:25 .bash_history
-rw-r--r--.  1 root root   18 Dec 29  2013 .bash_logout
-rw-r--r--.  1 root root  176 Dec 29  2013 .bash_profile
-rw-r--r--.  1 root root  176 Dec 29  2013 .bashrc
-rw-r--r--.  1 root root  100 Dec 29  2013 .cshrc
-rw-r--r--.  1 root root  129 Dec 29  2013 .tcshrc
[centos7_user@centos7 ~]$
Return to Notes list

Leave a Reply