This page serves as a tentative list of resources to study and experiment with the SFTP protocol after its original specification draft having expired and in the process of being forgotten. My hope is that SFTP will be great widely-adopted again.
My specific use cases are:
Check out websocketfs: https://github.com/sagemathinc/websocketfs
websocket-sftp
and websocketfs
, the former for the protocol (transport layer) and the latter for FUSE integration.Sadly I cannot find any libfuse3 binding in JS ecosystem for now…
I am now maintaining a fork of websocketfs, aiming to specifically enhance the websocket-sftp
package.
The original sftp-ws, SFTP over WebSocket: https://github.com/lukaaash/sftp-ws
There is a
modernfork (?) https://github.com/Inveniem/sftp-ws
(merely update the package so that it can be built using up-to-date toolchain)
To use it, a bridge program vfs
is needed:
Server:
const SFTP = require('./lib/sftp')
const server = new SFTP.Server({
port: 8888,
virtualRoot: '.',
readOnly: true,
})
Client:
npx vfs ws://localhost ./local --path PATH
Note that you need to patch the code to include a port argument and pass to sshfs with -p PORT
.
Under the hood, it invokes sshfs localhost:PATH -o slave
and communicate with it through the WebSocket channel.
(The option is aliased as passive
in later versions that is more inclusive)
This is reversible! You can make the SSH "client" act as an SFTP server. All you need is a reverse tunnel ssh -R xxxx:localhost:yyyy
. Like this.
I think this is the best part of SSHFS: The interoperability. You can mirror part of a file system to other machines as long as you have a working SSH connection.
Well, there is "gio mount sftp://USER@XYZ" after which you can access the files under "/run/user/1000/gvfs/sftp:host=XYZ,user=USER/SOME_PATH/…"
goombacloud – https://news.ycombinator.com/item?id=31813979.
The support looks promising.
Cannot make it work under MacOS.
Despite GVFS has monitor mechanism, it is not implemented in most protocols.
Website: http://www.greenend.org.uk/rjk/sftpserver/
Repository: https://github.com/ewxrjk/sftpserver
It is a well-maintained SFTP server with a reasonable client for some ad-hoc scriptings. Supports all SFTP protocol versions from v3 to v6! You can also find some background, extensions, comparison between protocol version, and more on its website.
When experimenting with "SFTP over WebSocket" (that's another story), I find it useful to pair a patched Green End SFTP Server with an also patched websocat; commands shown as below:
# WS server
websocat -b --exit-on-eof ws-l:127.0.0.1:8888 lengthprefixed:tcp:127.0.0.1:9999
# SFTP server
gesftpserver -H 127.0.0.1 -L 9999 --debug --websocat
The length-prefixed message framing technique is redundant for SFTP, but it works anyway.
Because the upstream repo is archived, the development work takes place in various forks (not sorted in any order):
The full fork scan on GitHub, retrieved 2023/8/29:
Repo | Stars | Forks | Ahead | Behind | Last Push |
---|---|---|---|---|---|
deadbeefsociety/sshfs | 26 | 3 | 37 | 0 | 2023-03-11 |
stevenxxiu/sshfs | 16 | 0 | 86 | 0 | 2023-05-07 |
neunenak/sshfs | 12 | 1 | 12 | 0 | 2022-11-26 |
andy0130tw/sshfs | 7 | 0 | 6 | 0 | 2022-06-16 |
rozhuk-im/sshfs | 1 | 0 | 13 | 0 | 2023-05-02 |
steamboatid/sshfs | 1 | 0 | 3 | 0 | 2022-09-10 |
njzhangyifei/sshfs | 1 | 0 | 23 | 136 | 2020-10-08 |
smartdisk/sshfs | 0 | 0 | 2 | 0 | 2023-07-13 |
a1346054/sshfs | 0 | 0 | 3 | 0 | 2022-09-03 |
tesla232/sshfs | 0 | 0 | 2 | 0 | 2022-08-01 |
g-easy/sshfs | 0 | 0 | 1 | 2 | 2022-02-15 |
peterbelm/sshfs | 0 | 0 | 2 | 13 | 2021-01-19 |
gururajrkatti/sshfs | 0 | 0 | 2 | 13 | 2020-12-31 |
martinetd/sshfs | 0 | 0 | 2 | 24 | 2019-11-29 |
nnsuite/tizenport-sshfs | 0 | 1 | 23 | 136 | 2019-07-17 |
wooksong/tizenport-sshfs | 0 | 0 | 97 | 23 | 2019-06-30 |
mssalvatore/sshfs | 0 | 0 | 2 | 45 | 2019-04-13 |
sdcloudt/sshfs | 0 | 0 | 1 | 56 | 2018-10-28 |
iori-yja/sshfs | 0 | 0 | 8 | 147 | 2017-06-04 |
Cloudxtreme/sshfs-1 | 0 | 0 | 1 | 166 | 2016-06-15 |
BTBurke/sshfs | 0 | 0 | 1 | 172 | 2016-02-27 |
Reference tables organized for myself:
https://hackmd.io/BplmLAiDSZekdat-G8-gqA
Chromium OS has SSHFS inside! If you have access to a recent Chrome OS device, you may have seen a text like "SSHFS is launching" during the initialization phase of its Linux subsystem.
https://chromium.googlesource.com/chromiumos/overlays/chromiumos-overlay/+/main/net-fs/sshfs/
https://wiki.samba.org/index.php/Editing_files_locally_on_server:_interoperability
–- My comment: SMB has a file alternation monitor, wondering if this is doable in SFTP/SSHFS context?