Issue with storage password as script environment variable

I think I’m missing something simple and obvious here.

Platform is Linux. Created a script to run restore jobs to a different repository directory. All is working as specified when I manually execute Duplicacy. But it fails when I try the same command in a script placing the password in an env variable.

Relevant scripts commands:

DUPLICACY_PASSWORD=“storage pw”
duplicacy restore -threads 8 -r 4327 +“Desktop/Outlook Archive/*”

Error from Duplicacy:

Enter storage password:Failed to read the password: read /dev/stdin: bad file descriptor

So where am I stumbling?

Wild guess here but it seems that it’s trying to read the password from stdin.

In any case, can you please run the script with debug mode duplicacy -d restore <rest of command> and paste the output here?

What is your default storage name? if it is not “default” then the env variable shall be DUPLICACY_STORAGENAME_PASSWORD

Can you elaborate on this? What do you mean “manually”? In the command line? How are you passing encryption keys in this case?

Try @TheBestPessimist’s instructions to enable verbose logging, this shall shed more light on what’s going on

1 Like

Diag output:

Storage set to /bkup2/duplicacy
Reading the environment variable DUPLICACY_PASSWORD
Failed to get the value from the keyring: keyring/dbus: Error connecting to dbus session, not registering SecretService provider: dbus: DBUS_SESSION_BUS_ADDRESS not set
Enter storage password:Failed to read the password: read /dev/stdin: bad file descriptor

Appears to be looking for a Keyring service that’s not available. Not sure why it would go there if I’m feeding it the password.

What is your default storage name? if it is not “default” then the env variable shall be DUPLICACY_STORAGENAME_PASSWORD

It is the default storage.

Can you elaborate on this? What do you mean “manually”? In the command line? How are you passing encryption keys in this case?

“Manually” meaning from the SSH command line. Password provided at the prompt.

You need to add export when setting the variable. Otherwise it will only be a shell variable that Duplicacy can’t see.

export DUPLICACY_PASSWORD=“storage pw”
duplicacy restore -threads 8 -r 4327 +“Desktop/Outlook Archive/*”
2 Likes

That (of course) worked.

Thanks and apologies for turning this into a shell scripting tutorial.:roll_eyes:

1 Like

Not accepted.

Your question means that our wiki still needs some fine tuning. :stuck_out_tongue_closed_eyes:

1 Like