0

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?

4
  • You didn't really explain what's the problem with "encryption or authentication". Feb 7, 2022 at 18:09
  • SFTP is the protocol I'm using. datatracker.ietf.org/doc/html/draft-ietf-secsh-filexfer-13 Feb 9, 2022 at 0:20
  • 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).
    – bjoster
    Feb 22, 2022 at 16:32
  • SFTP doesn't handle encryption or authentication at all. It's a (very useful) file transfer protocol. Feb 23, 2022 at 17:59

2 Answers 2

0

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.

-1

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.

4
  • 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). Feb 9, 2022 at 0:15
  • 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.
    – drookie
    Feb 9, 2022 at 13:16
  • 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"? Feb 10, 2022 at 16:48
  • @drookie Care to take some time and explain what you meant? Since for now you seems like the only one who possess the knowledge.
    – x-yuri
    May 16, 2022 at 5:25

Not the answer you're looking for? Browse other questions tagged .