<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Ubuntu Server Initial Setup Guide]]></title><description><![CDATA[<h2>Initial Server Setup on Ubuntu</h2>
<p dir="auto">When you first spin up a new Ubuntu server, getting right to work is tempting. However, before you jump into deploying web applications, hosting a NodeBB forum, or installing Nginx, it is crucial to establish a secure foundation.</p>
<p dir="auto">Relying on the default <code>root</code> account for day-to-day operations is a security risk. This guide will walk you through the essential first steps for any newly provisioned Ubuntu server: creating a dedicated user, granting the right privileges, and configuring a basic firewall.</p>
<h2>Step 1: Log In as Root</h2>
<p dir="auto">To begin, you will need your server's public IP address and the password (or SSH private key if you installed an SSH key for authentication) for the <code>root</code> account. Open your terminal and connect to your server as the <code>root</code> user using the following command, replacing <code>your_server_ip</code> with your actual IP address:</p>
<pre><code>ssh root@your_server_ip
</code></pre>
<p dir="auto">If a warning about host authenticity appears, accept it. If your server uses password authentication, provide your <code>root</code> password to log in. If your server uses an SSH key for authentication, you may need to enter SSH key passphrase the first time you use the key each session.</p>
<p dir="auto"><strong>Note:</strong> The <code>root</code> user has absolute power over the system. Because of the heightened privileges of the <code>root</code> account, you are discouraged from using it regularly. The <code>root</code> account can make very destructive changes, even by accident.</p>
<h2>Step 2: Create a New User</h2>
<p dir="auto">Now that you are logged in as <code>root</code>, let's create a standard user account. We will use this account moving forward. You can name this user whatever you like; for this example, we'll use <code>adminuser</code>.</p>
<pre><code>adduser adminuser
</code></pre>
<p dir="auto">The system will prompt you to create and confirm a strong password. You will also see prompts for additional information (like Full Name or Room Number). These are entirely optional—feel free to just press <strong>ENTER</strong> to skip them.</p>
<h2>Step 3: Grant Administrative Privileges</h2>
<p dir="auto">Our new user needs the ability to perform administrative tasks when necessary, like updating packages or managing server blocks later on. Instead of logging back in as <code>root</code>, we can grant this user superuser capabilities.</p>
<p dir="auto">On Ubuntu, users in the <code>sudo</code> group are automatically allowed to run administrative commands. Add your new user to this group:</p>
<pre><code>usermod -aG sudo adminuser
</code></pre>
<p dir="auto">From now on, whenever you need to execute a command with elevated privileges, you can simply type <code>sudo</code> before it.</p>
<h2>Step 4: Set Up a Basic Firewall</h2>
<p dir="auto">Ubuntu ships with a firewall configuration tool called UFW (Uncomplicated Firewall). Setting it up ensures that only authorized traffic can reach your server.</p>
<p dir="auto">When software is installed, it often registers its profile with UFW. Because we need to maintain our connection to the server, we must ensure SSH traffic is allowed before turning the firewall on.</p>
<p dir="auto">First, check the available application profiles:</p>
<pre><code>ufw app list
</code></pre>
<p dir="auto">You should see OpenSSH in the output, it will probably look like this:</p>
<pre><code>Available applications:
  OpenSSH
</code></pre>
<p dir="auto">Allow connections for OpenSSH by running:</p>
<pre><code>ufw allow OpenSSH
</code></pre>
<p dir="auto">Now, it is safe to enable the firewall:</p>
<pre><code>ufw enable
</code></pre>
<p dir="auto">Type <strong>y</strong> and press <strong>ENTER</strong> to confirm. You can verify that your firewall is active and that SSH connections are allowed by checking its status:</p>
<pre><code>ufw status
</code></pre>
<p dir="auto">And in the output, it will probably look like this:</p>
<pre><code>Status: active

To                         Action      From
--                         ------      ----
OpenSSH                    ALLOW       Anywhere
OpenSSH (v6)               ALLOW       Anywhere (v6)
</code></pre>
<p dir="auto">The firewall is currently blocking all connections except for SSH. As you continue building your server environment—such as opening ports 80 and 443 for web traffic later—you will adjust these UFW rules to allow the new services:</p>
<pre><code>ufw allow 80/tcp
ufw allow 443/tcp
</code></pre>
<h2>Step 5: Verify External Access for Your Regular User</h2>
<p dir="auto">Before closing your active root session, it is critical to verify that you can successfully log in and use <code>sudo</code> with your new user. If you have problems connecting, you can troubleshoot and make any necessary changes as <code>root</code>.</p>
<p dir="auto">Configuring SSH access for your new user depends on whether your server’s <code>root</code> account uses a password or SSH keys for authentication.</p>
<h3>If the root account uses password authentication</h3>
<p dir="auto">Open a new terminal window on your local machine and try connecting as your new user:</p>
<pre><code>ssh adminuser@your_server_ip
</code></pre>
<p dir="auto">When the terminal prompts for password of your new user, enter it then you will be logged in.</p>
<p dir="auto">Remember, if you need to run a command with administrative privileges, type <code>sudo</code> before it like this:</p>
<pre><code>sudo command_to_run
</code></pre>
<p dir="auto">You will receive a prompt for your user's password when using <code>sudo</code> for the first time each session (and periodically afterward).</p>
<h3>If the root account uses SSH key authentication</h3>
<p dir="auto">If you logged in to your <code>root</code> account using SSH keys, then password authentication is disabled for SSH. To log in as your regular user with an SSH key, you must add a copy of your local public key to your new user’s <code>~/.ssh/authorized_keys</code> file.</p>
<p dir="auto">Since your public key is already in the <code>root</code> account’s <code>~/.ssh/authorized_keys</code> file on the server, you can copy that file and directory structure to your new user account using your current session.</p>
<p dir="auto">The simplest way to copy the files with the correct ownership and permissions is with the <code>rsync</code> command. This command will copy the <code>root</code> user’s <code>.ssh </code>directory, preserve the permissions, and modify the file owners, all in a single command. Make sure to change <code>adminuser</code> of the command below to match your regular user’s name:</p>
<pre><code>rsync --archive --chown=adminuser:adminuser ~/.ssh /home/adminuser
</code></pre>
<p dir="auto">Now, open up a new terminal session on your local machine, and use SSH with your new username:</p>
<pre><code>ssh adminuser@your_server_ip
</code></pre>
<p dir="auto">You should be connected to your server with the new user account without using a password. Remember, if you need to run a command with administrative privileges, type <code>sudo</code> before the command like this:</p>
<pre><code>sudo command_to_run
</code></pre>
<p dir="auto">You will be prompted for your regular user’s password when using <code>sudo</code> for the first time each session (and periodically afterward).</p>
]]></description><link>https://ivan9.com/topic/5/ubuntu-server-initial-setup-guide</link><generator>RSS for Node</generator><lastBuildDate>Thu, 16 Apr 2026 13:38:43 GMT</lastBuildDate><atom:link href="https://ivan9.com/topic/5.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 05 Apr 2026 17:16:06 GMT</pubDate><ttl>60</ttl></channel></rss>