Sakura VPN ubuntu 18.04 disabling root access and kill initial root user

www.digitalocean.com

Adding a User

you can add a new user by typing:

  • sudo adduser newuser

 

Granting a User Sudo Privileges

If your new user should have the ability to execute commands with root (administrative) privileges, you will need to give the new user access to sudo. Let’s examine two approaches to this problem: adding the user to a pre-defined sudo user group, and specifying privileges on a per-user basis in sudo’s configuration.

Adding the New User to the Sudo Group

 

  • usermod -aG sudo newuser

The -aG option here tells usermod to add the user to the listed groups.

Deleting a User

In the event that you no longer need a user, it is best to delete the old account.

You can delete the user itself, without deleting any of their files, by typing the following command as :

  • sudo deluser newuser

If, instead, you want to delete the user’s home directory when the user is deleted, you can issue the following command :

  • sudo deluser --remove-home newuser

If you had previously configured sudo privileges for the user you deleted, you may want to remove the relevant line again by typing:

  • sudo visudo
root    ALL=(ALL:ALL) ALL
newuser ALL=(ALL:ALL) ALL   # DELETE THIS LINE

 

 

 

 

serverfault.com

 

Disable root ssh access by editing /etc/ssh/sshd_config to contain:

PermitRootLogin no

Fiddling with /etc/shadow, chsh -s /bin/false root all can be undone with a simple bootable CD/thumbdrive.

Or:

From help.ubuntu.com: "By default, the root account password is locked in Ubuntu". Please see the section "Re-disabling your root account" specifically. In order to reset the state of root's account, to install-default, use the following command:

sudo usermod -p '!' root