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

James Blackwell jblack at merconline.com
Tue Mar 7 01:41:19 GMT 2006


On Mon, Mar 06, 2006 at 10:31:03PM +0100, Goffredo Baroncelli wrote:
> 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

I can see why you'd need it. Can you clear up the following please?

 * Can you rewrite in PEP8?

 * Can you use the user config as well?

 * Can you add test cases for this?

> $ 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



-- 
My home page:   <a href="http://jblack.linuxguru.net">James Blackwell</a>
Gnupg 06357400  F-print AAE4 8C76 58DA 5902 761D  247A 8A55 DA73 0635 7400
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 191 bytes
Desc: Digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060306/4ea71323/attachment.pgp 


More information about the bazaar mailing list