DigitalOcean UFW installation and set up is an easy task as long as you have our handy guide by your side.
At Bobcares, we offer solutions for every query, big and small, as a part of our Server Management Services.
Let’s take a look at how our Support Team is ready to help customers install and set up UFW.
What is DigitalOcean UFW?
Uncomplicated Firewall, also known as UFW is a firewall management interface that simplifies the complexity of lower-level packet filtering technologies. In fact, UFW is a great way to secure our network when we are not sure which tool to pick. Let’s find out how to install DigitalOcean UFW from our Support Techs.
How to install and set up DigitalOcean UFW
Today, our Support Engineers are going to take us through how to set up a firewall with UFW on an Ubuntu server.
- First, install UFW via the following command:
sudo apt install ufw
Our Support Techs would like to point out that UFW comes installed on Ubuntu by default.
- After enabling with the command below, we have to ensure ssh port is allowed first. Else, we are likely to lock ourselves out of the system and not have access to DigitalOcean UFW.
ufw enable
- After that, we have to set up the rules seen below:
ufw allow https ufw allow http ufw allow ssh
- Then, it is time to restrict ssh access. In order to do that, we will create a user with root privilege.
adduser [username] usermod -aG sudo [username]
- After that, copy the ssh key to the new user’s home directory from the root :
cp ~/.ssh/authorized_keys ~[username]/.ssh/authorized_keys chown -R [username]:[username] ~[username]/.ssh
- Then, use another terminal to check whether we can log in to the new user via the same ssh key. In case this is not successful, check the ownership of the file and whether the key is copied correctly.
- Next, update the server’s ssh setting to change the port it listens to.
- Now it is time to head back to the terminal where we log in as root and open the /etc/ssh/sshd_config file to update the following lines to install DigitalOcean UFW:
#Port 22 PermitRootLogin yes PasswordAuthentication yes
We have to change 22 to any other number less than 1024 and update the lines as seen below:
Port [new port number] PermitRootLogin no PasswordAuthentication no
- Then, save the file.
- Next, update UFW to allow the new port as seen here:
ufw allow [new port] ufw reload
- After that, restart the ssh daemon and try to log in via the new port:
ssh -p [new port number] [username]@[server ip]
- Now, we can finally remove ssh port from ufw with the following command:
ufw delete allow ssh
[Need assistance with another query? We are available 24/7.]
Conclusion
To sum up, our skilled Support Engineers at Bobcares demonstrated how to install and set up DigitalOcean UFW.
PREVENT YOUR SERVER FROM CRASHING!
Never again lose customers to poor server speed! Let us help you.
Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.
0 Comments