When you installing linux server to you computer you will create new user trough instll wizard but most cloud (if not all) will create only root user which have all rights to everything on your server.
So login to your server as root
1. Create new user
First of all let’s create new user.
System will ask you for password and some other details (only password and password configrm are required).
I recommend to use strong password (you can create yourself or use some of password generators).
This user has no administrative privileges so add it to
sudoers group which grat all admin privileges to your user
usermod -aG sudo emma
Ubuntu server using UFW firewall, it’s installed from start but its disabled. So let’s setup it.
Some of applicaiton can register their profiles with firewall after installation. To show those you can tppe:
ufw app list
You will see something like this
#output Available applications: OpenSSH
Ok. Before activation firewall we need to make sure we dont lost access to server via SSH, so enable OpenSSH allication with firewall
ufw allow OpenSSH
After this step we can enable UFW firewall by typing:
y and press
Enter to continue. To show enabled ports / application type following:
# output Status: active To Action From -- ------ ---- OpenSSH ALLOW Anywhere OpenSSH (v6) ALLOW Anywhere (v6)
As you can see firewall allowing connection to OpenSSH on IPv4 and IPv6, by default all others connections are blocked.
3. Accessing server with regular user
To connect type:
You are now logged in as regular user but if you remember we added user to sudoers group. So if you need access some privileged commands you add
sudo before this command, System will ask you for your password.
So now you have good foundation fro your server and you can install more application on it if you need them. If they need public access (like web servers) don’t forget to add them to firewall rules.
At the end
If you are using strong password with small/big letters, numbers and special characters you have solid protechtion but i sill recommend to use keys for authentication which ill show you in this blog post Settig Up SSH Keys for Ubuntu.
Stay safe. Bye.
2020-07-31 13:32 +0000 (Last updated: 2021-08-22 17:30 +0000)
6b5944f @ 2021-08-22