How do I keep a persistent .onion address after rebooting for my hidden service on OpenWrt?

I'm running OpenWrt 18.06.1 on a GL-USB150. I have an SSH server running on the tor network.
This is the contents of my /etc/tor/torrc

Log notice syslog
DataDirectory /var/lib/tor
HiddenServiceDir /var/lib/tor/other_hidden_service/
HiddenServicePort 22 127.0.0.1:22
User tor

Each time I reboot my private key and .onion address changes, which I see in these files:

/var/lib/tor/other_hidden_service/hostname
/var/lib/tor/other_hidden_service/private_key

How do I make my onion address persistent?

/var/ and /tmp/ are memory-backed file systems and are not persisted over reboots. /etc/ is a flash-backed file system and is a typical place for configuration. Keeping “working directories” on /var/ is recommended to reduce flash wear and speed access.

5 Likes