Extend TrueNAS Web UI Session Timeout

June 28, 2022

If you're like me, the 5 minute inactivity timeout with TrueNAS's Web UI is too short and leads to frustration. You'll be in the middle of setting up datasets / shares and switch tabs for a few minutes only to come back to a login screen and losing your place.

There is a long standing bug tracked on IX System's JIRA about this, but it doesn't seem to have too much traction from the developers to make a spot on the roadmap.

In search of how to change the value myself, I came across a Github comment on one of the previous PRs. From that I was able to extract a one liner that you can run to set the timeout to whatever you want.

sed -i 's/auth.generate_token",\[300/auth.generate_token",\[129600/g'  /usr/share/truenas/webui/*.js
For TrueNAS SCALE Only
sed -ie 's/auth.generate_token",\[300/auth.generate_token",\[129600/g' /usr/local/www/webui/*.js
For TrueNAS CORE Only

Running that should give you a longer timeout on your next login. The above is set to 129600 seconds which is 36 hours. To set something else just calculate the number of seconds and replace the number above.

You can verify this works by logging out of your current session, giving your browser a hard refresh to clear the cache and running the above commands. Just be sure to run the one that corresponds to your correct version of TrueNAS (CORE vs SCALE).

I took this one step further and put that same command into a post-init script so that each time the server boots it executes that command. This allows it to persist even after system upgrades which otherwise would require manually running the command again.

Find this panel under System Settings > Advanced > Init/Shutdown Scripts

Hopefully this helps someone else!

Monitor your DNS Zones with ZoneWatcher

Be alerted of DNS record changes moments after they happen, not from upset customers.

ZoneWatcher screenshot