Secure a fresh VPS before you install Deployrr
A new VPS or dedicated server is on the public internet from the first minute. Bots try to log in to it right away. This page walks you through the basic steps to lock it down before you install Deployrr.
Before you start
Section titled “Before you start”- A VPS or dedicated server with a supported system. See Quick start for the list. The commands below are for Debian and Ubuntu.
- The server’s public IP address and the root login details from your provider.
- A way into your provider’s web console, also called the rescue or VNC console. If you lock yourself out, this is how you get back in. Find it in your provider’s panel now, before you change anything.
- A second terminal window on your own computer. You use it to test each change.
Create a regular user with sudo
Section titled “Create a regular user with sudo”If you start Deployrr as root, it stops with this message: “Do not run Deployrr as the root user. Run as a regular user with sudo privileges instead.” You need a regular user that can use sudo. For more on that message, see Deployrr install errors. To see these commands run, watch Docker on Proxmox LXC: creating a non-root user at 10:20.
-
Log in to the server as root. Replace
YOUR_SERVER_IPwith your server’s address:Terminal window ssh root@YOUR_SERVER_IP -
Create the user. Replace
NAMEwith the user name you want, here and in the later steps. Set a password when asked:Terminal window adduser NAME -
Add the user to the sudo group:
Terminal window usermod -aG sudo NAMEA minimal Debian install may not have
sudo. Ifusermodor a latersudo -vfails, run these as root, then repeat this step:Terminal window apt updateapt install sudo -
Keep this root session open. You need it in the next steps.
Set up SSH key login
Section titled “Set up SSH key login”An SSH key is a pair of files. The private key stays on your computer. The public key goes on the server. You log in with the key instead of a password.
-
On your own computer, not on the server, create a key. Press Enter to accept the default file name:
Terminal window ssh-keygen -t ed25519Set a passphrase when asked. It protects the key if someone copies the file.
-
Copy the public key to the server. Replace
NAMEandYOUR_SERVER_IP:Terminal window ssh-copy-id NAME@YOUR_SERVER_IPssh-copy-idneeds password login, which is still on at this point. It asks for the new user’s password.Windows does not include
ssh-copy-id. Use the manual method in the next step instead. -
If you could not use
ssh-copy-id, add the key by hand. On your computer, print the public key and copy the whole line:Terminal window cat ~/.ssh/id_ed25519.pubIn PowerShell, use
type $env:USERPROFILE\.ssh\id_ed25519.pub. -
In your root session on the server, create the folder and file for the key. Replace
NAME:Terminal window mkdir -p /home/NAME/.sshnano /home/NAME/.ssh/authorized_keys -
Paste the public key line, save, and exit nano.
-
Set the owner and permissions. Replace
NAME:Terminal window chown -R NAME:NAME /home/NAME/.sshchmod 700 /home/NAME/.sshchmod 600 /home/NAME/.ssh/authorized_keys -
Open a second terminal on your computer and log in as the new user:
Terminal window ssh NAME@YOUR_SERVER_IPIt should log you in with the key (or ask for your key passphrase), not the account password.
-
Check that
sudoworks in this session:Terminal window sudo -v
Do not go on until steps 11 and 12 work.
Turn off password login and root login
Section titled “Turn off password login and root login”For background on how SSH hardening fits into a home server build, see UDMS part 05: Secure SSH Access (manual setup, on a Proxmox LXC). Follow the steps on this page for a VPS.
-
In the new user’s session, back up the SSH settings:
Terminal window sudo cp /etc/ssh/sshd_config /etc/ssh/sshd_config.bak -
Look at what the server uses now:
Terminal window sudo sshd -T | grep -E 'passwordauthentication|permitrootlogin|kbdinteractiveauthentication'Many cloud images ship a file such as
/etc/ssh/sshd_config.d/50-cloud-init.confthat setsPasswordAuthentication yes. SSH uses the first value it finds, and files in that folder are read before the rest ofsshd_config. Editing onlysshd_configcan have no effect. -
Create a settings file that is read before the others. The name starts with
00so it comes first:Terminal window sudo nano /etc/ssh/sshd_config.d/00-hardening.conf -
Add these three lines, then save and exit:
PasswordAuthentication noPermitRootLogin noKbdInteractiveAuthentication no -
Test the settings for mistakes. No output means no errors:
Terminal window sudo sshd -tIf it prints an error, fix the file before you go on. Do not restart SSH with an error.
-
Restart SSH. On Debian and Ubuntu the service is called
ssh:Terminal window sudo systemctl restart sshOn other systems it is called
sshd:sudo systemctl restart sshd. -
Open a third terminal and log in again as
NAME. It should still work. -
Check the new values:
Terminal window sudo sshd -T | grep -E 'passwordauthentication|permitrootlogin|kbdinteractiveauthentication'You should see
noon all three lines.
If something goes wrong, restore the backup in a session you kept open, remove the drop-in file, and restart SSH again:
sudo cp /etc/ssh/sshd_config.bak /etc/ssh/sshd_configsudo rm /etc/ssh/sshd_config.d/00-hardening.confsudo systemctl restart sshOptional: change the SSH port
Section titled “Optional: change the SSH port”A new port cuts down the log noise from bots. It does not stop a targeted attack, so treat it as a small extra. Skip this section if you want fewer things that can go wrong. To see the idea, watch Docker on Proxmox LXC: SSH configuration at 12:03. It edits sshd_config directly and does not cover the ssh.socket step below.
-
Pick a port number between 1024 and 65535. This page uses
2222as the example. Replace it with your number. -
Allow the new port in your provider’s firewall panel, and in UFW if you use it. See the next section and Set a basic UFW rule set.
-
Back up the settings again:
Terminal window sudo cp /etc/ssh/sshd_config /etc/ssh/sshd_config.bak -
Add the port to your settings file:
Terminal window echo "Port 2222" | sudo tee -a /etc/ssh/sshd_config.d/00-hardening.conf -
Test the settings:
Terminal window sudo sshd -t -
Restart SSH. On Ubuntu 24.04 and newer, SSH starts through a socket, so you also reload systemd and restart the socket:
Terminal window sudo systemctl daemon-reloadsudo systemctl restart ssh.socketsudo systemctl restart sshUbuntu 22.04 and Debian do not use
ssh.socket. On those, the last command alone is enough. -
In a second terminal, log in on the new port. Replace
2222with your port:Terminal window ssh -p 2222 NAME@YOUR_SERVER_IP -
When it works, remove the old port 22 rule from your firewalls.
If the new port does not work, restore the backup in a session you kept open and restart SSH. On Ubuntu 24.04 and newer, also reload systemd and restart the socket:
sudo cp /etc/ssh/sshd_config.bak /etc/ssh/sshd_configsudo sed -i '/^Port 2222$/d' /etc/ssh/sshd_config.d/00-hardening.confsudo systemctl daemon-reloadsudo systemctl restart ssh.socketsudo systemctl restart sshUbuntu 22.04 and Debian do not use ssh.socket. On those, skip the two middle commands.
Set the provider firewall
Section titled “Set the provider firewall”Your provider’s web panel often has a firewall page, sometimes called security groups. It filters traffic before it reaches your server. This matters because ports that Docker publishes bypass UFW. A rule in the provider panel still blocks them.
- Open the firewall page in your provider’s panel.
- Allow inbound TCP on your SSH port. This is
22unless you changed it. - Allow inbound TCP on
80. - Allow inbound TCP on
443. Optionally allow UDP on443too, for HTTP/3. Browsers fall back to TCP if you skip it. - Block all other inbound traffic. Apps reached through Traefik use port 443, so their own ports do not need to be open. Keep ports
81and444blocked. Keep the Traefik dashboard port blocked too. It is8080by default, and Traefik Preparation prints “Port N assigned for Traefik dashboard” (or “Port N previously set for Traefik dashboard” when you run it again while Traefik is running). The dashboard has no login of its own on that port. To open it safely, see Open the Traefik dashboard without opening its port. - Apply the rules to your server.
- Open a new SSH session to check that you can still log in.
Optional: keep the system updated
Section titled “Optional: keep the system updated”-
Ubuntu already has
unattended-upgrades. On Debian, install it:Terminal window sudo apt updatesudo apt install unattended-upgrades -
Turn it on and accept the default:
Terminal window sudo dpkg-reconfigure unattended-upgrades
The system does not restart by itself unless you change that setting. Reboot when you can after kernel updates.
Optional: use Tailscale for private access
Section titled “Optional: use Tailscale for private access”If you do not want an app reachable from the internet, reach it over Tailscale instead. See Set up Tailscale. To see the Linux client install, watch Tailscale tutorial: Tailscale setup on Linux at 7:12. You can then also limit SSH in the provider panel to your Tailscale network if you want.
Install Deployrr
Section titled “Install Deployrr”-
Log in as
NAME, not root. -
Run the install command from Quick start with
sudo, as it shows. -
Start Deployrr as your regular user. Type
deployrrwith nosudo. -
In Prerequisites > System Type, pick VPS (“Virtual Private Server in the cloud”).
-
If Traefik Preparation stops with “Port N is occupied. This is needed for Traefik.”, another program is using one of the ports Traefik needs (80, 81, 443 or 444). Often it is a web server that came with your VPS image. Stop that web server, then run Traefik Preparation again.
-
Go to Proxy > Traefik and look at the Traefik Mode line (“Toggle how apps are exposed”). If it says NOT SET or Simple, leave it. NOT SET works as Simple. If it says Advanced, select Traefik Mode once. Each press flips the mode.
Use Simple on a VPS. A VPS has no router to forward port 80 to 81 and 443 to 444, which Advanced mode needs. See Simple vs Advanced Traefik mode.
Open the Traefik dashboard without opening its port
Section titled “Open the Traefik dashboard without opening its port”Traefik Preparation publishes the Traefik dashboard on its own port, 8080 by default. If 8080 was taken, it picked the next free port and saved it as TRAEFIK_PORT in your .env file. The dashboard has no login on that port. Ports that Docker publishes skip UFW, so the provider firewall is what keeps this port off the internet. Keep it blocked there (step 33) and use one of these ways in:
-
The dashboard address. Open
https://traefik.YOUR_DOMAIN. It asks for the username and password you set in Traefik Preparation (Basic HTTP Auth). For a stronger login, such as Authelia or TinyAuth, select TRAEFIK in Security > Manage Auth. It needs a Pro license and Traefik running in Production. See Choose a login method. -
Tailscale. With Tailscale on the server, open
http://TAILSCALE_IP:8080from a device on your tailnet. Use your dashboard port if it isn’t 8080. Tailscale traffic arrives inside its own encrypted connection, so the blocked port in the provider panel doesn’t stop it. -
An SSH tunnel. On your computer, run this and keep the session open. Add
-p 2222if you changed the SSH port:Terminal window ssh -L 8080:localhost:8080 NAME@YOUR_SERVER_IPThen open
http://localhost:8080in your browser. If your dashboard port isn’t 8080, put it in place of the second8080.
To check that the port is closed, run this from your own computer, not the server. Replace 8080 with your dashboard port:
curl -m 5 http://YOUR_SERVER_IP:8080It should time out. If it prints a page, fix the rule in the provider’s panel.
Check it worked
Section titled “Check it worked”-
Log in as
NAMEwith your key from a new terminal. It works. -
Try to log in as root:
Terminal window ssh root@YOUR_SERVER_IPIt is refused.
-
Try a password login:
Terminal window ssh -o PubkeyAuthentication=no NAME@YOUR_SERVER_IPIt is refused with
Permission denied (publickey). -
Run
sudo sshd -T | grep -E 'passwordauthentication|permitrootlogin|kbdinteractiveauthentication'. All three areno. -
From your computer, your apps open on
https://addresses. Other ports on the server do not answer.
If you get locked out
Section titled “If you get locked out”If every SSH session is closed and you can’t log in, use your provider’s web console. It works like a screen and keyboard attached to the server, so the SSH settings and firewalls on this page don’t block it.
-
Open the web console in your provider’s panel. It may be called console, VNC console or serial console.
-
Log in as
NAMEwith the account password you set withadduser. The SSH settings on this page only apply to SSH. The password still works at the console. -
Find out which port SSH listens on:
Terminal window sudo ss -tlnpLook for your SSH port, for example
:22or:2222. On Ubuntu 24.04 and newer, the program on that line can besystemdinstead ofsshd. That is normal. -
Test the SSH settings for mistakes. No output means no errors:
Terminal window sudo sshd -tIf you changed the SSH settings, undo your change with the restore commands on this page: after turning off password login or after changing the port. On Ubuntu 24.04 and newer, include the
daemon-reloadandssh.socketcommands, or the port does not change. -
If UFW is on, check that it allows your SSH port:
Terminal window sudo ufw statusIf the port is missing, allow it. Replace
22with your SSH port:Terminal window sudo ufw allow 22/tcp -
If the provider’s firewall blocks the port, fix the rule in the provider’s panel. The console can’t change it.
-
Log in over SSH from a second terminal before you close the console.
If you can’t log in at the console either, for example because you forgot the password, look in your provider’s panel for a password reset or a rescue mode. Each provider does this differently, so follow its guide.

