2FA problems / different time


i just installed a self-hosted vaultwarden docker container on my unraid-server. everything looks fine except of my 2FA. 2FA with email also works great. but with my totp-app i’ve got the problem that i have two different times. when i have a look at my vaultwarden-admin diagnostics i see server time and browser time.

i don’t get it why browser time is 2h before. i tried already ms edge and firefox. my system (windows 11) time is the same as the server time. so i don’t understand why the browser works with a different time.

does anyone know this problem?


Well, the times shown on that page are in UTC, so depending on where you live, that could be a time difference of 2 hours of course.

So, if that is correct, then the server time is probably 2 hours ahead, and not correctly configured.

Best would be to check the host if it is configured to use NTP for example.

with unraid the time is right. but I read that a docker container has its own timezone, is that correct?

i also tried to set the variable TZ with Value Europe/Berlin via Unraid. but unfortunately it doesn’t work.

Well the time could look right if you have it set to UTC as zone, but put the time to the Berlin zone, then the host is two hours ahead.

I would double check the host settings really good.

I once had a similiar problem and fixed it by mapping /etc/localtime of the host to /etc/localtime in the docker container. Looks something like that in docker-compose:

- /etc/localtime:/etc/localtime:ro

unfortunately I don’t use docker compose. However, I mapped it in unraid like this and it didn’t work. I have to admit that my knowledge of linux is not advanced enough to configure everything from the command line alone.

I was hoping that I only have to edit one entry in a file. but after everything I’ve found via google, it’s a bit more complicated to change the time zone in a container.

I will probably leave it at 2FA via mail, unless someone else has an idea of how I can solve the whole thing “simply” without advanced knowledge.

Anyway, thanks to everyone who has replied so far

I dont know unraid, but you can set parameters for the docker container, right?
Like the data directory with “-v /bw-data/:/data/”.

To map the timezone from the host add the start parameter “-v /etc/localtime:/etc/localtime:ro”.
Before you do that, check on the docker host, if the localtime on the server is right. You can do that with the following command: “zdump /etc/localtime”

Okay thanks.
I will try it later.

It’s weird. On my host and in my vaultwarden container both are showing the correct time when i use zdump /etc/localtime

back to the first post. the server time is correct, but the browser time is wrong. is this really a vaultwarden/container problem? because both (host and container) showing the correct time when i type zdump /etc/localtime.

Did you tried multiple browsers? Thats really weird.

There seems to be a misconfiguration somewhere and it’s not really a vaultwarden problem (the configured TZ should be irrelevant for the displayed UTC of the container). You can check with sites like https://nist.time.gov/ or https://uhr.ptb.de/ what the time should be and if your local device’s clock is off. It should also show your device’s timezone and then you can see if you have set it correctly or if your server is 2 hours ahead (e.g. if your local time in the CEST timezone is set as the UTC of the server).

1 Like

I just wanna let you guys know that my local switch (configuration) was the problem. I finally still do not know what the problem is but i put my server directly into my router. After that my time is correct and vaultwarden 2FA over TOTP is working fine.