Unable to use duplicacy set command to save env variables and ssh keys, passwords, etc

To me it’s important to setup a backup job to automatically be able to run via cron ect.

I’ve read through the documentation in regards to automatically be able to save things such as the backup password, s3 credentials, ssh keys etc. It’s not very clear at all.

I’m able to do a workaround but it requires manually editing the .duplicacy/preferences file.

For example, if I want to backup to an sftp server even if I use keys, I always get prompted for the following:

Enter SSH password:
Enter the path of the private key file:
Enter storage password for sftp

This prevents you from automatically running backups.

My workaround is manually editing the .duplicacy/preferences file to change the keys line:

“keys”: {
“password”: “MySecretPassword”,
“ssh_key_file”: “/home/upssnowman/.ssh/id_rsa”
},

It works flawlessly but it’s a pain to manually add this to any backup I want to run.

Not sure what’s the question?

Yes, you can edit the preferences manually, or you can set the environment variables, or use keychain, or use set command to set k/v pairs.

I’m not sure why are you not able to use it. Can you elaborate?

Thanks for responding. The issue is the current documentation assumes everyone is an expert on Duplicacy.

Instead of manually adding the following lines, to the .duplicacy/preferences file:

“keys”: {
“password”: “MySecretPassword”,
“ssh_key_file”: “/home/upssnowman/.ssh/id_rsa”
},

How would you “set” this with a duplicacy command.

Honestly the documentation is not clear.

Thanks!

tmp % mkdir -p /tmp/d1 /tmp/d2
tmp % cd /tmp/d1
d1 % ~/Downloads/duplicacy_osx_x64_2.7.2 init aaa  /tmp/d2
/tmp/d1 will be backed up to /tmp/d2 with id aaa

d1 % cat .duplicacy/preferences
[
    {
        "name": "default",
        "id": "aaa",
        "repository": "",
        "storage": "/tmp/d2",
        "encrypted": false,
        "no_backup": false,
        "no_restore": false,
        "no_save_password": false,
        "nobackup_file": "",
        "keys": null,
        "filters": "",
        "exclude_by_attribute": false
    }
]%

d1 % ~/Downloads/duplicacy_osx_x64_2.7.2 set -key "password" -value "MySecretPasswor"
New options for storage /tmp/d2 have been saved

d1 % cat .duplicacy/preferences
[
    {
        "name": "default",
        "id": "aaa",
        "repository": "",
        "storage": "/tmp/d2",
        "encrypted": false,
        "no_backup": false,
        "no_restore": false,
        "no_save_password": false,
        "nobackup_file": "",
        "keys": {
            "password": "MySecretPasswor"
        },
        "filters": "",
        "exclude_by_attribute": false
    }
]%

THANKS so much. I will try that.

But how do you set the following:

“ssh_key_file”: “/home/upssnowman/.ssh/id_rsa”

Exactly the same:

d1 % ~/Downloads/duplicacy_osx_x64_2.7.2 set -key "ssh_key_file" -value "/home/upssnowman/.ssh/id_rsa"
New options for storage /tmp/d2 have been saved

d1 % cat .duplicacy/preferences
[
    {
        "name": "default",
        "id": "aaa",
        "repository": "",
        "storage": "/tmp/d2",
        "encrypted": false,
        "no_backup": false,
        "no_restore": false,
        "no_save_password": false,
        "nobackup_file": "",
        "keys": {
            "password": "MySecretPasswor",
            "ssh_key_file": "/home/upssnowman/.ssh/id_rsa"
        },
        "filters": "",
        "exclude_by_attribute": false
    }
]%