Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the wp-youtube-lyte domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /var/www/wordpress/wp-includes/functions.php on line 6114

Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the wordpress-seo domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /var/www/wordpress/wp-includes/functions.php on line 6114
Linux - How To Create a Sudo User - The Grok Shop

Linux – How To Create a Sudo User

For admin work, using a non-root user with super-user privileges is good practice.  This user has to be created.  Let’s see how its done with an example on Debian 9:

First we SSH into our target machine:

$ ssh root@grokshop.tv
Enter passphrase for key '/c/Users/[user]/.ssh/id_rsa':
Linux li598-26.members.linode.com 4.9.0-9-amd64 #1 SMP Debian 4.9.168-1 (2019-04-12) x86_64

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
You have mail.
Last login: Tue Aug 20 18:37:55 2019 from 2600:1700:56a0:567f:64ef:ef32:9c86:4245

Now as root (or with sudo), we use the adduser command to create our new user.  You can just press enter at the prompts that appear:

root@li598-26:~# adduser grokman
Adding user `grokman' ...
Adding new group `grokman' (1000) ...
Adding new user `grokman' (1000) with group `grokman' ...
Creating home directory `/home/grokman' ...
Copying files from `/etc/skel' ...
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
Changing the user information for grokman
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]

Lastly, we can use the usermod command to add the user to the sudo group:

root@li598-26:~# usermod -aG sudo grokman

If you want to test it out – whoami should give you back root:

root@li598-26:~# su - grokman
grokman@li598-26:~$ sudo whoami

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 grokman:
root

 

Sharing is caring!

Leave a Comment

Your email address will not be published. Required fields are marked *