restic: sftp backend stopped working after 0.13.0 update

Output of restic version

restic 0.12.1 compiled with go1.16.6 on windows/amd64

restic 0.13.0 compiled with go1.18 on windows/amd64

How did you run restic exactly?

restic --repo sftp:example.com:/backup/restic/pcname snapshots

Content of .ssh\config

Host example.com
    HostName example.com
    User username
    IdentityFile "C:\Users\username\.ssh\example.key"

What backend/server/service did you use to store the repository?

sftp (on a FreeBSD machine)

Expected behavior

$ restic-v0.12.1 --repo sftp:example.com:/backup/restic/pcname snapshots

Enter passphrase for key 'C:\Users\username\.ssh\example.key':
enter password for repository:
...

Actual behavior

$ restic-v0.13.0 --repo sftp:example.com:/backup/restic/pcname snapshots

subprocess ssh: username@example.com: Permission denied (publickey).
Fatal: unable to open repo at sftp:example.com:/backup/restic/pcname: unable to start the sftp session, error: EOF

auth.log entry from the server when using v0.13.0:

sshd[982]: Connection reset by authenticating user username 192.168.1.55 port 61832 [preauth]

Steps to reproduce the behavior

run the commands above

Do you have any idea what may have caused this?

No

Do you have an idea how to solve the issue?

No

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 26 (16 by maintainers)

Most upvoted comments

@fd0 does work on my side as well

> restic_v0.13.0-43-g192288bc_windows_amd64.exe --repo sftp:example.com:/backup/restic/pcname snapshots
Enter passphrase for key 'C:\Users\username\.ssh\example.key':
enter password for repository:
...

The provided version (restic_v0.13.0-43-g192288bc_windows_amd64.exe) works for me on Windows 10. The key passphrase is prompted.

Some quick test shows that using CREATE_NEW_PROCESS_GROUP is behaving correctly for both raw and shimmed rclone and ssh, and the cleaning after Ctrl+C is also handled properly. So should I create a new PR?

Huge thanks to @DRON-666

@cqjjjzr I just ran some simple tests and turns out you can just change DETACHED_PROCESS to CREATE_NEW_PROCESS_GROUP in you PR.