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