mirror of
https://github.com/restic/restic.git
synced 2025-10-28 00:58:38 +00:00
sftp: Allow password entry
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.
This commit is contained in:
@@ -470,7 +470,7 @@ func open(s string, opts options.Options) (restic.Backend, error) {
|
||||
case "local":
|
||||
be, err = local.Open(cfg.(local.Config))
|
||||
case "sftp":
|
||||
be, err = sftp.Open(cfg.(sftp.Config))
|
||||
be, err = sftp.Open(cfg.(sftp.Config), SuspendSignalHandler, InstallSignalHandler)
|
||||
case "s3":
|
||||
be, err = s3.Open(cfg.(s3.Config))
|
||||
case "gs":
|
||||
@@ -522,7 +522,7 @@ func create(s string, opts options.Options) (restic.Backend, error) {
|
||||
case "local":
|
||||
return local.Create(cfg.(local.Config))
|
||||
case "sftp":
|
||||
return sftp.Create(cfg.(sftp.Config))
|
||||
return sftp.Create(cfg.(sftp.Config), SuspendSignalHandler, InstallSignalHandler)
|
||||
case "s3":
|
||||
return s3.Create(cfg.(s3.Config))
|
||||
case "gs":
|
||||
|
||||
Reference in New Issue
Block a user