Feature suggestion: sftp over ssh client in a single connection

Darren Tucker dtucker at zip.com.au
Tue Jul 12 21:26:49 EST 2005

Timo Lilja wrote:
> It has always bugged me that if I want to use a shell and perform some
> file transfers in a single host I have to take two SSH connections:
> one for the shell via ssh(1) and one for the file transfer via
> sftp(1). Some graphical SSH clients can perform sftp operations and
> ssh shell access in a single connection by using SSH2 protocol's
> support for multiple channels.

You can sftp and a shell over a single SSH connection with the 
ControlMaster/ControlPath feature:

$ ssh -MS /tmp/sock sshserver
$ sftp -o 'ControlPath /tmp/sock' sshserver

(on the current development version you can do it more transparently 
with "ControlMaster auto").

> So I hacked my openssh client to start the sftp prompt when the escape
> sequence '~S' has been entered. The sftp session is implemented by
> opening another channel into the same connection. After the user has
> quit the sftp prompt, the client returns to the original ssh with
> possible shell prompt or whatever.

The above won't run sftp from an escape sequence, though.

Darren Tucker (dtucker at zip.com.au)
GPG key 8FF4FA69 / D9A3 86E9 7EEE AF4B B2D4  37C9 C982 80C7 8FF4 FA69
     Good judgement comes with experience. Unfortunately, the experience
usually comes from bad judgement.

More information about the openssh-unix-dev mailing list