Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Switching from sftp to ssh without exiting and logging in

637 views
Skip to first unread message

rp

unread,
Aug 30, 2010, 4:55:07 AM8/30/10
to
Hello,
I would like to be able to switch from sftp to the ssh CL without
exiting and logging in. As far as I know, you currently can't do that
in openssh. Will this possible in future versions of openssh?

Many thanks.

rp

Nico Kadel-Garcia

unread,
Aug 30, 2010, 9:08:10 PM8/30/10
to

I cannot even imagine how this could work. You'd have to open a local
shell on the server and somehow feed the sftp command line interface
to it, or somehow switch both the client to an SSH client and the
connection on the remote end to a shell.

This doesn't sound like something that can be done sanely or securely.

Simon Tatham

unread,
Aug 31, 2010, 4:04:20 AM8/31/10
to
Nico Kadel-Garcia <nka...@gmail.com> wrote:
> This doesn't sound like something that can be done sanely or securely.

I don't see any reason it should be insecure. The same SSH
connection can easily contain multiple channels, one of which is
SFTP and the other a shell, or can close down one of those and start
another. Existing servers could handle such a feature perfectly
well. All you'd need would be a client capable of handling the mode
- something which was both an SFTP client and a conventional SSH
client and capable of switching between one mode and the other.

Alternatively, you could have a modular client structure in which
one client program opens and manages an SSH session, and other
client processes connect to that one to open individual channels
within that session. So you'd authenticate once to the first client,
and could then start up any number of SFTP or shell instances
reusing the existing session state. (In fact, doesn't OpenSSH
already support this via the -M option?)
--
Simon Tatham "The distinction between the enlightened and the
<ana...@pobox.com> terminally confused is only apparent to the latter."

Dag-Erling Smørgrav

unread,
Aug 31, 2010, 6:40:33 AM8/31/10
to
Nico Kadel-Garcia <nka...@gmail.com> writes:

> rp <phi...@free.fr> writes:
> > I would like to be able to switch from sftp to the ssh CL without
> > exiting and logging in.
> I cannot even imagine how this could work. You'd have to open a local
> shell on the server and somehow feed the sftp command line interface
> to it, or somehow switch both the client to an SSH client and the
> connection on the remote end to a shell.

No. The SSH protocol is multiplexed, so you can open additional
sessions in separate channels over the same connection. This is how
OpenSSH's master / slave mode works. Add the following in your
~/.ssh/config:

Host foo.example.com
ControlMaster auto
ControlPath ~/.ssh-%r@%h:%p

The first client that connects to foo.example.com (whether ssh, scp or
sftp) will automatically become a master, and subsequent connections
will be slaves. You can't switch back and forth between sftp and a
shell, but you can have an sftp connection in one tty and a shell in
another.

DES
--
Dag-Erling Smørgrav - d...@des.no

0 new messages