Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please add sftp.extra_args #4241

Closed
yacoob opened this issue Mar 11, 2023 · 4 comments · Fixed by #4519
Closed

Please add sftp.extra_args #4241

yacoob opened this issue Mar 11, 2023 · 4 comments · Fixed by #4519

Comments

@yacoob
Copy link

yacoob commented Mar 11, 2023

Output of restic version

restic 0.15.1 compiled with go1.19.5 on linux/amd64

What should restic do differently? Which functionality do you think we should add?

I need to point ssh restic is using to a specific keyfile. In order to provide both repository and ssh command like this:

restic  \
  --option sftp.command=ssh\ -p\ 23\ -l\ abcd\ -i\ /etc/restic/keys/foo\ targethost\ -s\ sftp   \
  --repo sftp://abcd@targethost:23

Can you please add something like sftp.extra_args that would be used directly in buildSSHCommand and just added to the command line? I can then say --option sftp.command=-i\ /etc/restic/keys/foo and the whole thing would look cleaner.

The solution suggested in the manual (using ~/.ssh/config) is nice, but I'd really like to keep all config file in a single place, and avoid having them intermixed with otherwise unrelated entries in ssh's config. I can make a separate config file for this purpose, but then I need to point ssh to it, which brings us to the same problem as my initial one :)

What are you trying to do? What problem would this solve?

The restic command line invocation would look cleaner.

Did restic help you today? Did it make you happy in any way?

Eyeballing restic as borgbackup replacement; doing so would allow me to use a cheaper backend storage :)

Thanks!

@nettnikl
Copy link

Hi, having the same problem. Workaround is presented in #312 (comment) and #312 (comment).

Seeing

func buildSSHCommand(cfg Config) []string {
however, i don't think it's to much of an issue to add this extra option, and would be much, much cleaner.

@quite
Copy link

quite commented Jun 11, 2023

Yes, an option to influence how buildSSHCommand works is much needed. Precisely for adding custom options such as -i file to the resulting ssh commandline, without having to write the whole ssh ... commandline oneself. Having to do that also makes the host:port part of the sftp--repo URI useless.

adamantike added a commit to adamantike/restic that referenced this issue Oct 18, 2023
Allow setting custom arguments for the `sftp` backend, by using the
`sftp.args` option. This is similar to the approach already implemented
in the `rclone` backend, to support new arguments without requiring
future code changes for each different SSH argument.

Closes restic#4241
@adamantike
Copy link
Contributor

I have created #4519, looking forward to solve this issue and make those workarounds obsolete.

MichaelEischer pushed a commit to adamantike/restic that referenced this issue Oct 21, 2023
Allow setting custom arguments for the `sftp` backend, by using the
`sftp.args` option. This is similar to the approach already implemented
in the `rclone` backend, to support new arguments without requiring
future code changes for each different SSH argument.

Closes restic#4241
@adamantike
Copy link
Contributor

sftp.args is now available in version 0.16.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants