OS Prep: Users, Packages, and SSH

Ubuntu OS setup

Table of contents

  1. Source
  2. Create new user and give sudo privileges
  3. Update Ubuntu OS
  4. Install basic and required packages
  5. Change SSH port to 2053
    1. Change systemd configuration for ssh.socket
  6. Check our work

Source

These steps are based on Anand’s OS setup guide at Ultimate Docker Server: Getting Started with OS Preparation Part 1.

  • The steps below are adapted from this guide to match Ubuntu 24.04 SSH requirements.

  • These steps will prepared us to install Docker later using Anand’s excellent SimpleHomelab Deployarr application.

Do

Create new user and give sudo privileges

adduser kurt
adduser kurt sudo

Update Ubuntu OS

sudo apt update
sudo apt upgrade

Install basic and required packages

sudo apt install sudo linux-generic ca-certificates curl gnupg lsb-release ntp htop zip unzip gnupg apt-transport-https ca-certificates net-tools ncdu apache2-utils git neofetch vsftpd mc

linux-generic is required to enable GPU passthrough from Proxmox to the Ubuntu VM. It is not included in the Ubuntu Cloud-Init distribution used by the Tteck Ubuntu installation script.

Change SSH port to 2053

These instructions are different than what is on Anand’s site due to changes in Ubuntu 24.04 SSH.

Change systemd configuration for ssh.socket

To change the port of the SSH server, the systemd configuration for ssh.socket must be changed or supplemented. The configuration adjustment is made by editing the socket using systemctl.

  1. Edit ssh.socket file:

     systemctl edit ssh.socket
    
  2. Add the following lines at the top under the two initial commented lines:

     [Socket]
     ListenStream=
     ListenStream=2053
    

    The blank line ListenStream= is required to ensure that port 22 is no longer used. Without this line, the SSH server would then be accessible via port 22 (default) and 2053.

  3. Restart SSH:

    systemctl daemon-reload
    sudo systemctl restart ssh  
    
  4. Reboot the VM:

     reboot 
    

Check our work

  1. Ensure that port 22 is closed and port 2053 is open:

     netstat -ant | grep 2053
    
     sudo lsof -nP -iTCP -sTCP:LISTEN
    
     sudo netstat -tunpl
    
  2. SSH root check: Log into Ubuntu server using new SSH port 2053

     ssh root@192.168.1.100 -p 2053
    
  3. SSH user check: Log into Ubuntu server using new SSH port 2053

     ssh kurt@192.168.1.100 -p 2053