diff --git a/borg/remote.py b/borg/remote.py index 19a1416a0..c9d8145ba 100644 --- a/borg/remote.py +++ b/borg/remote.py @@ -3,6 +3,7 @@ import fcntl import msgpack import os import select +import shlex from subprocess import Popen, PIPE import sys import tempfile @@ -160,7 +161,7 @@ class RemoteRepository: return ['--umask', '%03o' % self.umask] def ssh_cmd(self, location): - args = ['ssh'] + args = shlex.split(os.environ.get('BORG_RSH', 'ssh')) if location.port: args += ['-p', str(location.port)] if location.user: diff --git a/borg/testsuite/repository.py b/borg/testsuite/repository.py index 5df0a6f97..5a1524ed9 100644 --- a/borg/testsuite/repository.py +++ b/borg/testsuite/repository.py @@ -328,6 +328,8 @@ class RemoteRepositoryTestCase(RepositoryTestCase): def test_ssh_cmd(self): assert self.repository.umask is not None assert self.repository.ssh_cmd(Location('example.com:foo')) == ['ssh', 'example.com', 'borg', 'serve'] + self.repository.umask_flag() + os.environ['BORG_RSH'] = 'ssh --foo' + assert self.repository.ssh_cmd(Location('example.com:foo')) == ['ssh', '--foo', 'example.com', 'borg', 'serve'] + self.repository.umask_flag() class RemoteRepositoryCheckTestCase(RepositoryCheckTestCase): diff --git a/docs/usage.rst b/docs/usage.rst index 95b95d90d..6bd292e14 100644 --- a/docs/usage.rst +++ b/docs/usage.rst @@ -48,6 +48,8 @@ General: can either leave it away or abbreviate as `::`, if a positional parameter is required. BORG_PASSPHRASE When set, use the value to answer the passphrase question for encrypted repositories. + BORG_RSH + When set, use this command instead of ``ssh``. TMPDIR where temporary files are stored (might need a lot of temporary space for some operations)