By default, our Debian templates come with root access.
We will access our server via SSH as below,
Once we've accessed the server, we will create a new user with limited privileges.
By creating a new user, this will provide the user with their own home directory.
Run the below command to grant the new user with
sudo or Administrative privileges,
usermod -aG sudo user1
Debian will not have UFW installed by default. We will run the below commands to install it using
apt update apt install ufw
In UFW, you can list and manage rules for a predefined set of applications. In order to list available profiles,
ufw app list
We will allow firewall to make SSH connections by executing the below command,
ufw allow OpenSSH
root@vps:~# ufw allow openSSH Rules updated Rules updated (v6)
To enable UFW, run the below command,
Make sure that you've allowed SSH connection, otherwise, you will be locked out and you may have to manually gain access to the server via VNC console and then allow SSH connections.
root@vps:~# ufw enable Command may disrupt existing ssh connections. Proceed with operation (y|n)? y Firewall is active and enabled on system startup
To check the status of UFW, run the below command,
root@vps:~# ufw status Status: active To Action From -- ------ ---- OpenSSH ALLOW Anywhere OpenSSH (v6) ALLOW Anywhere (v6)
To enable external access for the newly created user, run the below command,
cp -r ~/.ssh /home/user1 chown -R user1:user1 /home/user1/.ssh