To start a basic setup there are a few configuration steps. In this article, you are going to learn the initial setup with Debian 10. So follow this tutorial to see how to increase the security and usability of your server and a solid foundation for subsequent actions. In the end, you will be an expert on how to log into our server as the root user, create a new user with admin privileges, and set up a basic firewall.
Initial Setup with Debian 10
Step 1– Logging in as Root
You need to be familiar with your server’s public IP address to log in to your server. If you have already installed an SSH key authentication, you also need to know the password. Log in as the root user using the following command to connect to your server.
You may be asked to enter the passphrase if you are using an SSH key. And if this is your first time logging into the server with a password, you should change the root password.
Step 2– Creating a New User
when you log in as root, you need to add a new user account. As you see in the following command, it is called noodi and you can replace it with your favorite one.
Try to enter a strong password when you are asked.
Step 3– Granting Administrative Privileges
If you need to limit normal users to log in and log back in as the root account, you may set up the superuser or root privileges for our normal account. So a normal user should put the word sudo before the command to run commands with administrative privileges. Note that you should add the new user to the sudo group. Run this command to add the new user to the sudo group.
usermod -aG sudo noodi
Step 4– Setting Up a Basic Firewall
You will learn how to use the UFW firewall to use it for firewall policies and manage exceptions. You can use the apt package manager to install UFW. But the first update the local index to retrieve the latest information. Then install the UFW firewall software by using the below command.
apt update apt install ufw
You can manage named sets of the firewall with firewall profiles. all available application profiles would be list by typing:
ufw app list
Available applications: . . . OpenSSH . . .
Do not forget to make sure the firewall allows SSH connections, by entering the following command.
ufw allow OpenSSH
To proceed, you can type y and press ENTER. To check SSH connections are allowed or not, type below command.
Status: active To Action From -- ------ ---- OpenSSH ALLOW Anywhere OpenSSH (v6) ALLOW Anywhere (v6)
Step 5– Enabling External Access for Your Regular User
As you have a regular user for daily use, you should make sure that SSH into the account directly. Any time you log in into your root account, the password authentication is enabled for SSH. Open a new terminal session using SSH with your new username and SSH to your new user account.
Please note that if you run a command with administrative privileges, type sudo before it.
You can copy the file and directory structure to your new user account in your existing session with the cp command if the public key is in the root account’s ~/.ssh/authorized_keys file on the server.
Then adjust the ownership of the files using the chown command.
p -r ~/.ssh /home/noodi chown -R noodi:noodi /home/noodi/.ssh
Now by logging in via SSH with your new username, open a new terminal session.
In the case of running a command with administrative privileges, type sudo before it.
Dear user, we wish this tutorial initial Setup with Debian 10would be helpful for you, to ask any question or review the conversation of our users about this article, please visit Ask page. Also to improve your knowledge, there are so many useful tutorials ready for Eldernode training.