In this article from the Linux Tutorials, we want to teach you the Initial server setup with Debian 10.
Here you learn how to log in as a root user, create a new user with root privileges, and set up a basic firewall.
Initial Server Setup with Debian 10
Log in as root in Debian 10
To log into your server, you need to know your public IP address. you can get your server’s public IP address with the following command:
curl icanhazip.com
Log in as the root user with the following command:
ssh root@your_server_ip
Note: If this is your first time logging into the server with a password, you may also be prompted to change the root password.
Create a new user in Debian 10
When you log in as root you are ready to create a new user. you can create a new user with the following command. we choose Orcacore for our new user you can choose any name you want.
adduser orcacore
Here you have to choose a strong password for your user and answer other questions, you can press enter for other questions to skip.
Root privileges in Debian 10
After you created your user you need to give root privileges to it so that the user can run commands with root privileges. user should use “sudo” before each command that has access to the privileges.
On Debian 10, users should be in the “sudo” group to access the sudo commands.
Run this command below as root to add your user to the sudo group.
usermod -aG sudo orcacore
Tip: when you log in as your new user you can use sudo before each command to run the commands with root privileges.
Set up a basic firewall for server setup in Debian 10
In this article, we use the UFW firewall to help set firewall policies and manage exceptions.
Use the following commands to install the UFW firewall:
apt update apt install ufw
Now OpenSSH, the service allowing you to connect to our server, has a firewall profile that you can use.
You can list all available application profiles by the following command:
ufw app list
Here you can allow SSH connection with the command below:
ufw allow OpenSSH
Enable the firewall with the following command:
ufw enable
Type “y” and press enter to proceed. you can see the active status for SSH connections with the following command:
ufw status
External access for your new user in Debian 10
If the Root Account Uses Password Authentication
If you logged in to your root account using a password, then password authentication is enabled for SSH. You can SSH to your new user account by opening up a new terminal session and using SSH with your new user:
ssh orcacore@your_server_ip
Enter your user password and use sudo before each command.
sudo command_to_run
At this point, you need to add a copy of your local public key to the new user’s “~/.ssh/authorized_keys
” file to log in successfully. then you can adjust ownership of the files using the “chown
” command. follow the commands below:
cp -r ~/.ssh /home/orcacore chown -R orcacore:orcacore /home/orcacore/.ssh
Open a new terminal and log in via SSH with your new user:
ssh orcacore@your_server_ip
Enter your user password and use sudo before each command.
sudo command_to_run
Conclusion of initial server setup with Debian 10
Now you learn about the initial server setup with Debian 10 and you can install any software you need on your server.
I hope you enjoy it.