Score:0

How do I use SFTP without SSH?

nf flag

I want a fast and flexible file server but I don't need encryption or authentication. How can I use SFTP for this on Linux systems?

so flag
You didn't really explain what's the problem with *"encryption or authentication"*.
Kyler Laird avatar
nf flag
SFTP is the protocol I'm using. https://datatracker.ietf.org/doc/html/draft-ietf-secsh-filexfer-13
bjoster avatar
cn flag
SFTP is a protocol built for encryption and authentication, if you do not want to use encryption or authentication you will have to use something else like TFTP oder HTTP (WebDAV).
Kyler Laird avatar
nf flag
SFTP doesn't handle encryption or authentication at all. It's a (very useful) file transfer protocol.
Score:0
nf flag

I originally asked and answered this on stackoverflow but I was told it's off-topic there and should be posted here. It's such a handy tool that I want to be sure I keep it documented so I can find it next time I need it.

SFTP happens to be used by SSH servers but it's a well-developed protocol that works well on its own. The sftp-server developed by OpenSSH has no dependency on an SSH server; sftp-server uses standard input/output. (Other SFTP servers are similar.)

It is trivial to share a filesystem via SFTP, similar to what you might do with NFS but without the need for root access. I'll use socat as the daemon for this ad-hoc example, but xinetd would make a more permanent solution. The location of sftp-server is from my Ubuntu installation of the openssh-sftp-server package.

On the server:

$ mkdir shared_to_the_world
$ cd shared_to_the_world
$ socat tcp-listen:1234,reuseaddr,fork exec:/usr/lib/openssh/sftp-server

On the client:

$ mkdir /tmp/sftp_test
$ sshfs -o reconnect,ssh_command="nc my_sftp_server_address 1234 --" : /tmp/sftp_test
$ cd /tmp/sftp_test

Now your client (and anyone else's!) can seamlessly work with the files in the shared directory on the server. Both read and write are enabled, so be careful.

Consider using socat listen's "bind" and "range" options to limit the access to your server.

Score:-1
za flag

You can't.

SFTP is a subproto of SSH, despite being visibly an FTP derivative (but it's not). FTP derivative is FTPS, a version with transport encryption.

Kyler Laird avatar
nf flag
Pfft. I do. I've been using raw SFTP in production for over a year. SFTP is easy to use over a single port. FTP is not (although it can be done).
drookie avatar
za flag
Good for ya. You seem to be mature and clever. Although you didn’t get a single word from the answer. But I’m sure this is temporary, and will go away after few years more.
Kyler Laird avatar
nf flag
Oh, I misunderstood. What was it you were trying to say about "SFTP is a subproto of SSH"? Perhaps you meant to say "Even though this protocol is described in the context of the SSH2 protocol, this protocol is general and independent of the rest of the SSH2 protocol suite"?
cn flag
@drookie Care to take some time and explain what you meant? Since for now you seems like the only one who possess the knowledge.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.