diff options
author | Lars Wirzenius <liw@liw.fi> | 2011-12-29 15:00:31 +0000 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2011-12-29 15:00:31 +0000 |
commit | 2dc2cc99246c9c77d6dbd042bbb7e79e60f7d367 (patch) | |
tree | b5f72a8e00fa17f57c88a1a2f9370fc55ebe1baa | |
parent | c5de2f4d08d94a4f8efcc15d22b41279eb667123 (diff) | |
download | obnam-2dc2cc99246c9c77d6dbd042bbb7e79e60f7d367.tar.gz |
implement --ssh-key setting for openssh authentication
-rw-r--r-- | obnamlib/plugins/sftp_plugin.py | 5 | ||||
-rwxr-xr-x | test-sftpfs | 1 |
2 files changed, 5 insertions, 1 deletions
diff --git a/obnamlib/plugins/sftp_plugin.py b/obnamlib/plugins/sftp_plugin.py index caa600f8..d5ff89a7 100644 --- a/obnamlib/plugins/sftp_plugin.py +++ b/obnamlib/plugins/sftp_plugin.py @@ -146,7 +146,10 @@ class SftpFS(obnamlib.VirtualFileSystem): '-oClearAllForwardings=yes', '-oProtocol=2', '-p', str(self.port), '-l', self.user, - '-s', self.host, 'sftp'] + '-s'] + if self.settings and self.settings['ssh-key']: + args += ['-i', self.settings['ssh-key']] + args += [self.host, 'sftp'] try: proc = subprocess.Popen(args, diff --git a/test-sftpfs b/test-sftpfs index c8ad2ae7..fca64d1c 100755 --- a/test-sftpfs +++ b/test-sftpfs @@ -44,6 +44,7 @@ class SftpTests(unittest.TestCase, obnamlib.VfsTests): 'pure-paramiko': False, 'create': True, 'sftp-delay': 0, + 'ssh-key': '', } self.fs = obnamlib.plugins.sftp_plugin.SftpFS(baseurl, settings=settings) |