Help using password-file

Hello,

I’m trying to use the password-file option to read my b2 credentials, but I’m running into a little trouble.

When I run restic with --password-file /home/me/passwd.txt

it returns the message:
"Fatal: unable to open B2 backend: Account ID ($B2_ACCOUNT_ID) is empty.

If I don’t specify the repo with the -r flag, but instead try to read that from the passwd.txt file, it gives me the message:
“Fatal: Please specify repository location”

So, it appears that restic is not accessing the passwd.txt file at all.

Can someone tell me the proper way to use the password-file flag? What is the correct syntax to use for the credentials in the password file?

Thanks

If I read the documentation correctly the password-file is meant to contain nothing but the password. You must not place anything else in there.

If you want to save all information in a file you can source it.

Contents of credentials.txt:

export RESTIC_REPOSITORY="b2:bucketname:path/to/repo"
export B2_ACCOUNT_ID="myid"
export B2_ACCOUNT_KEY="mysecretkey"

On the command line:

user@client:~$ source credentials.txt
user@client:~$ restic backup /path/to/files

Also the user you run the restic command as must be able to read the password file. Make sure that the permissions are set correctly.

Yeah, now that I read the documentation correctly, I think you’re right. :smiley:

Thanks for setting me straight!

I’m glad you figured it out, thanks @moritzdietz for the help!

If you have any idea on how to improve the documentation (e.g. wording, adding a setence or so), please let us know!