Skip to content

Support us

Authors: fire1ce | Created: 2022-06-25 | Last update: 2022-06-25

UDM Persistent SSH Keys

UDM will discard any Authorized Keys for SSH every reboot or firmware upgrade. This script will allow you to persist your SSH keys in the UDM and survive reboots.

Github Repository: UDM Persistent SSH Keys


  • 2023-02-22 - Fixed support for UDM Pro Firmware 1.x and 2.x and 3.x - Must reinstall the script after upgrade from 1.x to 2.x

Persistence on Reboot

This script need to run every time the system is rebooted since the /root/.ssh/authorized_keys overwrites every boot.
This can be accomplished with a boot script. Flow this guide: UDM / UDMPro Boot Script


  • Tested on UDM PRO
  • UDM Pro doesn't support ed25519 SSH Keys


The script was tested on UDM PRO

(!) Depending on firmware your $DATA_DIR will be /mnt/data (Firmware 1.x) or /data (Firmware 2.x and 3.x)

curl -s | sh

Add you public RSA keys to:



Delete the file

rm -rf $DATA_DIR/on_boot.d/

Delete your authorized_keys file

rm -rf $DATA_DIR/ssh/authorized_keys


At boot the script with read the $DATA_DIR/ssh/authorized_keys file and add the content to UDM's /root/.ssh/authorized_keys

Manual run: