Switching from sftp to ssh without exiting and logging in

Showing 1-4 of 4 messages
Switching from sftp to ssh without exiting and logging in rp 8/30/10 1:55 AM
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

Re: Switching from sftp to ssh without exiting and logging in Nico Kadel-Garcia 8/30/10 6:08 PM

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.

Re: Switching from sftp to ssh without exiting and logging in Simon Tatham 8/31/10 1:04 AM
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."

Re: Switching from sftp to ssh without exiting and logging in Dag-Erling Smørgrav 8/31/10 3:40 AM
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