Is there a client that combines SSH and SFTP? [on hold]

I often find myself using ssh and sftp side-by-side in my Ubuntu terminal. A typical workflow looks like this:

  1. Log into some server with SSH and SFTP using the same public key on separate terminal windows.
  2. Create a directory with SSH.
  3. put some files into the directory with SFTP.
  4. Set permissions with chmod over SSH.

It can be kind of annoying doing all of this with two terminal windows, so I'd really prefer if I could make it appear that this is all happening within a single process.

The questions I have are:

Is there a good reason the ssh and sftp processes need to be kept separate? Or would it be "safe" for me to go ahead and write an application that combines them?


Update: It appears that sftp supports many common terminal commands. However, it still does not support any arbitrary terminal command, as is the case with ssh. So I would still like to see an answer to these questions rather than a justification as to why an answer is unnecessary.


There is nothing like "SSH commands". Those are shell commands. To an SSH terminal/client, the shell is just a black box with an input and an output. The client does not even understand that you type some commands, let only understanding them.

So any solution that does what you ask for, would have to be tailored for a certain system and shell, to be able to understand what you are doing.

A theoretical client could of course have a specific command or prefix that you would use to specify, if the command you are typing is a shell or SFTP command. Similarly to the ftp escape-to-local-shell prefix/command !.

But even then you may have difficulties matching the current working directories. If for nothing else then because the SFTP can be chrooted and the shell not. Bear in mind that the SFTP is an independent system, that in theory may use a completely different file system representation.

So the conclusion is, that this is doable, but it's so much hacking and so much system- and shell- specific that it's hardly feasible to make the system universal. A reliable solution would require some server-side components (like a special type of a shell).

I know what I'm writing about, because I have implemented bit of this for my SFTP client, the WinSCP. There, within a SFTP session, you can open a terminal/console window, which starts an shell session and changes its working directory to the current SFTP working directory (by sending the shell cd command). So I know how hackish and unreliable this is.

Use sshfs to mount the remote filesystem. Then run commands or copy files just as you would do on your local system. Refer to your system's documentation to learn how it is used.

I'm not aware of anything that literally combines sftp and ssh into the single interface that you have barely/vaguely described. Without knowing in much more detail exactly what you want to see out of such a client, I cannot give a better answer.

There are other ways of doing the things you describe.

sftp can do all of that

[email protected]:~/tmp$ sftp localhost
[email protected]'s password:
Connected to localhost.
sftp> mkdir test
sftp> cd test
sftp> put /home/rbabchis/chicken.JPG
Uploading /home/rbabchis/chicken.JPG to /home/rbabchis/test/chicken.JPG
/home/rbabchis/chicken.JPG                                                                                             100% 2035KB   2.0MB/s   00:00
sftp> chmod 777 chicken.JPG
Changing mode on /home/rbabchis/test/chicken.JPG
sftp> quit
[email protected]:~/tmp$

Transfers while in an SSH terminal session

But if are talking about transferring files while at a remote bash prompt over SSH, I have yet to see a standard way of doing this. Though, your question did remind me of the 90s where we used things like Zmodem to transfer over a terminal session. So I googled it and look what I found.

Check this out (using Zmodem over ssh):

Category: ubuntu Time: 2016-07-31 Views: 3
Tags: ubuntu ssh sftp

Related post

iOS development

Android development

Python development

JAVA development

Development language

PHP development

Ruby development


Front-end development


development tools

Open Platform

Javascript development

.NET development

cloud computing


Copyright (C), All Rights Reserved.

processed in 0.193 (s). 12 q(s)