"Fatal: wrong password or no key found"

I had backed up a database on a windows server to B2 after having followed instructions here https://help.backblaze.com/hc/en-us/articles/115002880514-How-to-configure-Backblaze-B2-with-Restic-on-Linux

On attempting to restore the backup on my ubuntu laptop, kept getting the error “Fatal: wrong password or no key found” even though the RESTIC_PASSWORD environment variable was being attempted to be set to the same password string using the ‘export’ command on my bash script. Also, passing in the password manually on the command line was leading to the same error, but running restore on the windows machine was working fine. Found with further troubleshooting, that trying to enter the password on the powershell command line was too causing the same error. Putting the password into a file and using RESTIC_PASSWORD_FILE too didn’t help!

I am not sure why special characters were being truncated when env variable was set in the windows machine using the ‘set’ command on the batch script(Google search didn’t help here). I had a “%8” and a “^” in the password string that was being truncated. Therefore, the actual password of the remote repository didn’t have these characters in the password!

Took me a wasted day to figure this out. Hope it helps someone.

Even though this is not a bug in Restic, it would help if the password could be passed into Restic using a config file to avoid this special-char-truncation problem when setting environment variables.

That’s rather unexpected.

Well, it wouldn’t work as the actual repo password didn’t have the “%8” and “^” chars in the password when initiated, as these had been truncated from the password exported to the environment variable. So, the password in the password file was incorrect even though it was the same string as that exported as env variable.

Did you enclose the restic password in quotes? My password is, and also contains those symbols plus an @ and I have/had no issues?

@doscott That’s right. For some reason in the repo init script, the env variables couldn’t be set on win 2008 server when using quotes, but worked when I removed the quotes. That is what led to the problem. I’m sure it was an error in the script. Learnt a lesson not to use unquoted strings when setting env vars.