Skip to main content
Servers Are UpVirtual Datacenter
Virtual Datacenter
Pricing
Sign inExplore plans
Servers Are UpVirtual Datacenter
Virtual Datacenter
Pricing
Sign inExplore plans

Loading…

Servers Are UpVirtual Datacenter

Private cloud servers, pooled Virtual Datacenters, and encrypted cloud storage on hardware we own—open any server in your browser or automate with API & MCP.

Customer Portal & Services

Client DashboardMy ServersBrowser ConsoleBillingAPI Keys & MCPSupport
SLA with service creditsOwned hardwareUS-based

Make room for your next idea

Explore the capacity, apps and access options that fit your workload. Check current availability and your total before you buy.

Sign up freeView Pricing

Products

  • Linux VPS
  • Windows VPS
  • Cloud & SaaS Services
  • Cloud Storage (Azure)
  • Virtual Datacenter
  • AI & Agent Hosting
  • Containers
  • Instant Apps
  • Software Platforms
  • Network builder
  • Game Servers
  • Free Game Servers
  • Pricing

Resources

  • Free Network Tools
  • 2026 Pricing Benchmark
  • Live SVG Badges
  • Latency & Speed Test
  • Guides & Tutorials
  • Documentation
  • API Reference
  • MCP Server
  • CLI & SDKs
  • OpenAPI & llms.txt
  • Use Cases
  • Free Migration
  • Uptime & Reliability
  • Datacenter
  • System Status
  • Network
  • Provider Comparisons Hub
  • Compare Providers

Company

  • About Us
  • Enterprise
  • Security Architecture
  • Trust Center
  • Blog
  • FAQ
  • Compliance
  • Startup Program
  • Open-Source Sponsorship
  • Press & Media Kit
  • Referral Program
  • Help Center
  • Contact Us
© Servers Are Up
TermsPrivacySLARefund PolicyDPAAcceptable Use
Service information
Docs
  • Documentation Hub
  • Technical Knowledge Library
    Runbooks & 187 Blueprints
  • Choose a Product
    VMs, Containers & Cloud
  • First Linux Server
    SSH, Firewall & Apps
  • Windows Server 2025
    BYOL & Remote Desktop
  • Remote Access
  • Troubleshooting
  • FAQ
  • All Product Guides
    29 Step-by-Step Guides
  • Cloud & SaaS Catalog
    112 Cloud & SaaS Offerings
  • Azure Cloud Storage
    Hot/Cool/Archive & WORM
  • Resource Manager & RBAC
    Groups, Tags & Locks
  • Multi-Model Cloud DB
    JSONB, SQL & pgvector
  • Cloud Identity & ZTNA
    OIDC, SCIM & PIM
  • Key Vault & KMS
    Secrets & Envelope Keys
  • Cloud SIEM, SOAR & DLP
    Posture & Threat Response
  • API Gateway & Cloud DNS
    Edge WAF & DNS Zones
  • Serverless, Workflows & IoT
    Functions, Queues & DAGs
  • SaaS, Governance & Vault
    Budgets & Off-Host GRS
  • Linux Systems & Kernel
    SSH, UFW, sysctl & OOM
  • Self-Hosted Apps & Stacks
    Caddy, Nextcloud & Auth
  • Build Web Apps with AI
  • Next.js and React
  • TypeScript and Node.js
  • npm and Tooling
  • Data and APIs
  • Deploy and Operate
  • Tutorials
  • Infrastructure
  • Automation & Regions
  • API Overview
  • API v1 Reference
    Endpoints & 23 Scopes
  • MCP Server
    129 AI Agent Tools
  • Swagger / OpenAPI 3.1
  • API Playground
  • Versioning & Sunset
  • API Token Security
    Authentication & Tokens
  • Instances API
    Compute Resources
  • Networking API
    Networks & Ports
  • Storage API Availability
    Volumes & Backups
  • Webhooks & Events
    Event Notifications
  • Rate Limits & Best Practices
    Throttling & Retries
  • sau CLI Reference
    34 Commands (v0.2)
  • Browser Web CLI
  • SDKs
  • Infrastructure as Code
    Terraform & Ansible
  • Code Examples
  • CLI & SDK Guides
  • Security Guides
  • Security at a Glance
  • Zero Trust Architecture
  • Live Trust Center
  • Compliance
Need help?

Loading documentation...

Documentation/deploy operate

Set up a fresh Ubuntu 24.04 server safely

Give a new Ubuntu 24.04 server your own sudo user, sign-in by SSH key only, a firewall and automatic security updates.

Beginner
20 min
Updated 2026-10-27

Deploy Ready-to-Run Infrastructure in Seconds

Linux VMs from $6/mo · Pooled Virtual Datacenters from $12/mo · Use code WELCOME20 for 20% off your first order.

Browse ServersView Pricing

Commands checked on 2026-10-27 with Ubuntu 24.04, OpenSSH 9.6, ufw 0.36.

What you will have at the end

A server you sign in to as your own user, with your SSH key and never a password, where that user can run commands as root with sudo. The firewall admits SSH and nothing else until you open a port on purpose, and security updates install themselves every day.

Before you start

  • A server running Ubuntu 24.04 and an account on it that can use sudo. On a Servers Are Up Linux server that account is sauuser: its password is on the server's page, and root cannot sign in at all. See SSH Key Management for how to reach the server over SSH.
  • An SSH key pair on your own computer. ssh-keygen -t ed25519 makes one; the public half is the one-line file ending in .pub.
  • Two terminal windows. You keep the first one signed in until the last check passes, so a mistake never locks you out.

In the commands, SERVER_ADDRESS and PORT are the address and port you sign in with, deploy is the user you create (use any name), and YOUR_PUBLIC_KEY is the whole line of your .pub file.

Steps

1. Bring the system up to date

Install the updates the image was built without, before anything else runs on the server.

sudo apt update
sudo DEBIAN_FRONTEND=noninteractive apt -y full-upgrade

When apt finishes, look for the file /var/run/reboot-required. If it exists, a new kernel or library is waiting: run sudo reboot, wait a minute and sign in again.

2. Create your own user and give it sudo

A user of your own, with its own password, means every command you run as root is logged under your name. adduser asks for the new password twice. sudo will ask for this password, so keep it.

sudo adduser --comment "" deploy
sudo usermod -aG sudo deploy

adduser prints passwd: password updated successfully after the second password. Check the groups with id deploy: the list includes 27(sudo).

3. Let your key sign in as that user

The key goes in the user's authorized_keys file, and SSH ignores that file unless only the user can write to it.

sudo install -d -m 700 -o deploy -g deploy /home/deploy/.ssh
echo 'YOUR_PUBLIC_KEY' | sudo tee /home/deploy/.ssh/authorized_keys > /dev/null
sudo chown deploy:deploy /home/deploy/.ssh/authorized_keys
sudo chmod 600 /home/deploy/.ssh/authorized_keys

4. Prove the key and sudo work, from your second terminal

Do this before turning passwords off. Run it on your own computer, not on the server.

ssh -t -p PORT deploy@SERVER_ADDRESS 'sudo -v && echo sudo works'

SSH signs you in with the key without asking for a password. sudo then asks for the password from step 2, and the last line reads sudo works. If SSH asks for a password instead, stop here and read What can go wrong.

5. Turn off password and root sign-in

A file in /etc/ssh/sshd_config.d/ whose name sorts first wins over the others, so 00- is read before the 50-cloud-init.conf that cloud images ship with password sign-in on.

printf 'PasswordAuthentication no\nKbdInteractiveAuthentication no\nPermitRootLogin no\n' | sudo tee /etc/ssh/sshd_config.d/00-hardening.conf > /dev/null
sudo sshd -t
sudo systemctl reload ssh
sudo sshd -T | grep -E '^(passwordauthentication|kbdinteractiveauthentication|permitrootlogin) '

sshd -t prints nothing when the configuration is valid. The last command prints the three settings the server now uses:

permitrootlogin no
passwordauthentication no
kbdinteractiveauthentication no

On a Servers Are Up server, the web terminal on the server's page signs in with sauuser's password, so it stops working from this step on. Your SSH sessions and the server's other controls are not affected.

6. Turn on the firewall with SSH allowed

Allow SSH first and only then enable the firewall, or enabling it ends your own session.

sudo apt install -y ufw
sudo ufw default deny incoming
sudo ufw default allow outgoing
sudo ufw allow OpenSSH
sudo ufw --force enable
sudo ufw status verbose

The status reads Status: active, Default: deny (incoming), allow (outgoing), deny (routed) and one rule pair for 22/tcp (OpenSSH). When the server later serves a website, open its ports with sudo ufw allow 80,443/tcp.

On Servers Are Up, nothing reaches the server from the internet until you turn an entry point on from its page or add a port forward, whatever this firewall allows. The firewall still matters: it is what stands between the server and the other machines on its private network.

7. Install security updates automatically

unattended-upgrades installs updates from Ubuntu's security pocket once a day. The two settings below switch on the daily run.

sudo apt install -y unattended-upgrades
printf 'APT::Periodic::Update-Package-Lists "1";\nAPT::Periodic::Unattended-Upgrade "1";\n' | sudo tee /etc/apt/apt.conf.d/20auto-upgrades > /dev/null
sudo unattended-upgrade --dry-run --debug 2>&1 | grep 'Allowed origins'

The last line names the archives it installs from, and they include the security pocket: Allowed origins are: o=Ubuntu,a=noble, o=Ubuntu,a=noble-security, ....

Check that it works

From your second terminal, sign in with the key, then try a password sign-in on purpose:

ssh -p PORT deploy@SERVER_ADDRESS 'echo key sign-in works'
ssh -p PORT -o PubkeyAuthentication=no deploy@SERVER_ADDRESS

The first prints key sign-in works. The second is refused at once with Permission denied (publickey)., which means the server no longer offers password sign-in to anyone. Only now close the first terminal.

What can go wrong

  • sudo asks for a password and none works. The user was created without one, or with a different one than you remember. From the account you started with, run sudo passwd deploy and set it again.
  • SSH asks for a password in step 4 instead of using the key. The key is not being accepted. Run sudo ls -la /home/deploy/.ssh on the server: the folder must read drwx------ deploy deploy and the file -rw------- deploy deploy, and the file must hold your public key on one line. A line broken in two when you pasted it is the usual cause.
  • sudo systemctl reload ssh says the unit is not active. On Ubuntu 24.04 SSH starts on demand, and the service runs while someone is signed in over SSH. Run the step from an SSH session, or use sudo systemctl restart ssh.
  • You closed every session and no longer get in. On a Servers Are Up Linux server, Rebuild on the server's page reinstalls the system with a new password; the data volume and the address stay. Anything else on the system disk is lost, which is why step 4 comes before step 5.

Good practice

  • Keep one user per person. Shared accounts make the log useless when something goes wrong.
  • Sign in with keys only, and keep a second key somewhere safe, such as a password manager.
  • Change SSH settings in a 00- file in /etc/ssh/sshd_config.d/ rather than in sshd_config, so an update that replaces the main file keeps your settings.
  • Open a port only when something listens on it, and remove the rule when the service goes.
  • Read /var/log/unattended-upgrades/unattended-upgrades.log now and then, and reboot when /var/run/reboot-required appears.

Where to go next

  • Firewall Configuration
  • SSH Key Management
  • Find and fix vulnerable packages with npm audit

Related Articles

Tune Linux UDP sysctls, SteamCMD, FiveM, and PaperMC servers

Read more

Run a Next.js app as a systemd service on Ubuntu

Read more

Frequently Asked Questions

What does the Set up a fresh Ubuntu 24.04 server safely documentation guide cover?
Give a new Ubuntu 24.04 server your own sudo user, sign-in by SSH key only, a firewall and automatic security updates. It is rated beginner difficulty (20 min) and applies to Servers Are Up infrastructure and workflows.
Can I manage or automate these steps through the Servers Are Up dashboard, REST API v1, or MCP server?
Yes. Every Servers Are Up server includes browser-based SSH, WebRDP, and VNC console access in the dashboard, plus programmatic control via the REST API v1 (/api/v1) and hosted Model Context Protocol server (/api/mcp/v1) using a scoped Personal Access Token.

Need hands-on help with Set up a fresh Ubuntu 24.04 server safely?

Every Servers Are Up virtual machine and container includes an integrated HTML5 browser-based SSH, RDP, and VNC console in your dashboard, default-off inbound firewall rules with per-IP allow-lists, and full programmatic control via REST API v1 and Model Context Protocol (MCP). Explore our Virtual Datacenter Plans or reach out to Servers Are Up Support.

Was this article helpful?

On this page

What you will have at the endBefore you startSteps1. Bring the system up to date2. Create your own user and give it sudo3. Let your key sign in as that user4. Prove the key and sudo work, from your second terminal5. Turn off password and root sign-in6. Turn on the firewall with SSH allowed7. Install security updates automaticallyCheck that it worksWhat can go wrongGood practiceWhere to go next
Need Live Commands?

Open Aria in Wide Engineering Mode for distro-specific commands, compose tweaks, and isolated environment troubleshooting.

Knowledge Library