[RFC][PATCH] sftp transport whithout sftp subsystem configured

Goffredo Baroncelli kreijack at alice.it
Mon Mar 6 21:31:03 GMT 2006


Hi all,

on the server that hosts my projects, the sftp subsystem isn't 
configured on the sshd server. It still possible to do sftp but it is 
needed to pass the explicit path of the sftp-server to the sftp client.

$ sftp XXXXXX at goffredo-baroncelli.homelinux.net
Connecting to goffredo-baroncelli.homelinux.net...
Enter passphrase for key 'YYYYYYYYY/id_dsa':
Request for subsystem 'sftp' failed on channel 0
Couldn't read packet: Connection reset by peer
ghigo at venice:~$ sftp -s /usr/libexec/openssh/sftp-server XXXXXX at goffredo-baroncelli.homelinux.net
Connecting to goffredo-baroncelli.homelinux.net...
Enter passphrase for key 'YYYYYYYY/id_dsa':
sftp> ls
bzr                                     goffredo.baroncelli.homelinux.net
[...]

The same problem exists with bazaar; the aim of the patch below is to provide
to the client an explicit path of the sftp-server which will be passed to the 
server.
The code below checks if the environment variable BZR_OVERRIDE_SFTP_SUBSYSTEM is 
defined: if yes, passes its value (the sftp-server path) to the client.

$ BZR_OVERRIDE_SFTP_SUBSYSTEM=/usr/libexec/openssh/sftp-server \
  bzr.dev/bzr branch sftp://XXXXX@goffredo-baroncelli.homelinux.net//YYYYYY/bzr/hgweb_devel
Enter passphrase for key '/YYYYYYYYYY/id_dsa':
[===                                                       ] copy  2/30


I know that this is an hack, but I don't know how otherwise I can solve my 
problem ( I can't change the sshd server configuration )....

Comments are welcome

$ bzr diff
=== modified file 'a/bzrlib/transport/sftp.py'
--- a/bzrlib/transport/sftp.py
+++ b/bzrlib/transport/sftp.py
@@ -124,7 +124,10 @@
                 args.extend(['-p', str(port)])
             if user is not None:
                 args.extend(['-l', user])
-            args.extend(['-s', hostname, 'sftp'])
+            if 'BZR_OVERRIDE_SFTP_SUBSYSTEM' in os.environ:
+                    args.extend([hostname, os.environ['BZR_OVERRIDE_SFTP_SUBSYSTEM']])
+            else:
+                    args.extend(['-s', hostname, 'sftp'])
         elif vendor == 'ssh':
             args = ['ssh', '-x']
             if port is not None:



Goffredo

-- 
gpg key@ keyserver.linux.it: Goffredo Baroncelli (ghigo) <kreijack at inwind_DOT_it>
Key fingerprint = CE3C 7E01 6782 30A3 5B87  87C0 BB86 505C 6B2A CFF9
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 191 bytes
Desc: not available
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060306/b55b97b3/attachment.pgp 


More information about the bazaar mailing list