Initial Server Setup with Debian 10 – Easy Setup

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. Let’s see how you can do it.

Initial Server Setup with Debian 10

We want to begin with learning root login in the 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

Tips: To get more information you can check this guide on 4 Linux Commands to Get Public IP Address.

Log in as the root user on Debian 10 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 create your user you need to give root privileges to it so that the user can run commands with root privileges. The 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 the below command as root to add your user to the sudo group:

usermod -aG sudo orcacore

Note: 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 step of the Initial Server Setup with Debian 10, 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 your 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 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

Here you can use SSH keys instead of using password authentication. To generate new SSH keys you can follow our article about How to generate SSH key pairs in Linux.

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

At this point, you have learned the Initial Server Setup with Debian 10 that every user must know including creating a new user, granting the root privileges for it, and setting up a basic firewall.

I hope you enjoy it. Also, you may like to read the following articles:

Initial Server Setup with Debian 12 Bookworm

Initial Server Setup with AlmaLinux 9

Initial Server Setup with Rocky Linux 9

Newsletter Updates

Enter your email address below and subscribe to our newsletter

Leave a Reply

Stay informed and not overwhelmed, subscribe now!