Notes – Add a Sudo User on Ubuntu

adduser ubuntu_user

 

usermod -aG sudo ubuntu_user

 

root@ubuntu:~# adduser ubuntu_user
Adding user `ubuntu_user' ...
Adding new group `ubuntu_user' (1001) ...
Adding new user `ubuntu_user' (1001) with group `ubuntu_user' ...
Creating home directory `/home/ubuntu_user' ...
Copying files from `/etc/skel' ...
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
Changing the user information for ubuntu_user
Enter the new value, or press ENTER for the default
        Full Name []:
        Room Number []:
        Work Phone []:
        Home Phone []:
        Other []:
Is the information correct? [Y/n] Y
root@ubuntu:~#
root@ubuntu:~# usermod -aG sudo ubuntu_user
root@ubuntu:~#

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

root@ubuntu:~# su - ubuntu_user
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.

ubuntu_user@ubuntu:~$ sudo ls -la /root
[sudo] password for ubuntu_user:
total 24
drwx------  3 root root 4096 Jul 17 03:09 .
drwxr-xr-x 22 root root 4096 Jul 15 07:10 ..
-rw-------  1 root root  379 Jul 17 03:11 .bash_history
-rw-r--r--  1 root root 3106 Oct 22  2015 .bashrc
drwxr-xr-x  2 root root 4096 Jul 17 02:52 .nano
-rw-r--r--  1 root root  148 Aug 17  2015 .profile
ubuntu_user@ubuntu:~$
Return to Notes list

 

Leave a Reply