-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
sftp: Allow password entry #1270
Conversation
This was a bit tricky: We start the ssh binary, but we want it to ignore SIGINT. In contrast, restic itself should process SIGINT and clean up properly. Before, we used `setsid()` to give the ssh process its own process group, but that means it cannot prompt the user for a password because the tty is gone. So, now we're passing in two functions that ignore SIGINT just before the ssh process is started and re-install it after start.
dd1bcb9
to
fb9729f
Compare
Codecov Report
@@ Coverage Diff @@
## master #1270 +/- ##
=========================================
+ Coverage 52.82% 52.9% +0.07%
=========================================
Files 131 130 -1
Lines 12437 12441 +4
=========================================
+ Hits 6570 6582 +12
+ Misses 5106 5090 -16
- Partials 761 769 +8
Continue to review full report at Codecov.
|
Works great here, for all I can tell it now asks me for the password of my key when the ssh-agent isn't loaded. Great! |
Nice, thanks for the feedback! |
@fd0 how to use this feature? The documentation still mentions only the key based config: https://restic.readthedocs.io/en/latest/030_preparing_a_new_repo.html#sftp Thanks in advance. |
Hm, you should have been asked for the password interactively. If that doesn't work, please open a new issue so we can triage it. Thanks! |
This was a bit tricky: We start the ssh binary, but we want it to ignore SIGINT. In contrast, restic itself should process SIGINT and clean up properly. Before, we used
setsid()
to give the ssh process its own process group, but that means it cannot prompt the user for a password because the tty is gone.So, now we're passing in two functions that ignore SIGINT just before the ssh process is started and re-install it after start.
Closes #448