Feature suggestion: sftp over ssh client in a single connection

Timo Lilja timo.lilja at hut.fi
Tue Jul 12 07:47:29 EST 2005

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.

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 actual implementation is rather simple: The client basically forks
another process and runs a slightly modified version of the sftp
interactive_loop(). A little bit of hacking is needed so that the
primary ssh2_channel won't take the input/output while the sftp
session is active. The forking ensures that clientloop.c's select(2)
is performed normally so that the forwarded connections still work.

I can provide the patches if needed but since I am not very familiar
with the openssh code and not at all familiar with security related
code I think that someone who knows what he/she is doing might do a
better job ;-).

Timo Lilja

"It's a 106 miles to Chicago. We've got a full tank of gas, 
half a pack of cigarettes, it's dark, and we're wearing sunglasses."

More information about the openssh-unix-dev mailing list