Changing the Ubuntu user name. Print

  • 0

To begin with, it is recommended to perform an update:

sudo apt update && sudo apt upgrade

Creating a user and answering the questions:
adduser user_name

Now you need to add the created user to sudo:
adduser sudo user_name

If the adduser command is not available, you can do it via visudo. To open the /etc/sudoers file, enter:
sudo visudo
you need to add the line user_name ALL=(ALL) ALL and save it.

Now you need to perform basic security settings, open sshd_config:
nano /etc/ssh/sshd_config

And we change / add lines:
Disable authorization from root by replacing the string PermitRootLogin yes with PermitRootLogin no
Allow ssh connection only to the created user by adding/replacing the AllowUsers username string
Prohibit the use of .rhosts files by adding/replacing the line IgnoreRhosts yes
Prohibit cross-hosting authentication (Host-Based Authentication) by adding / replacing the HostbasedAuthentication no string

Next, restart ssh:

systemctl restart sshd


Was this answer helpful?

« Back