Skip to content

Commit 882d3a0

Browse files
committed
add documentation on bypassing SSH
1 parent 113882a commit 882d3a0

1 file changed

Lines changed: 33 additions & 0 deletions

File tree

README.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,39 @@ On BSD and macOS, to unmount the filesystem:
5555
umount mountpoint
5656
```
5757

58+
### Bypassing SSH
59+
60+
#### Using directport
61+
62+
Using direct connections to sftp-server to bypass SSH for performance is also possible. To do this, start a network service using sftp-server (part of OpenSSH) on a server, then connect directly using `-o directport=PORT` option.
63+
64+
On server (listen on port 1234 using socat):
65+
66+
`socat tcp-listen:1234,reuseaddr,fork exec:/usr/lib/openssh/sftp-server`
67+
68+
On client:
69+
70+
`sshfs -o directport=1234 127.0.0.1:/tmp /tmp/mnt`
71+
72+
Note that this is insecure as connection will happen without encryption. Only use this on localhost or trusted networks. This option is sometimes used by other projects to mount folders inside VMs.
73+
74+
IPv6 is also possible:
75+
76+
`socat tcp6-listen:1234,reuseaddr,fork exec:/usr/lib/openssh/sftp-server`
77+
78+
`sshfs -o directport=1234 [::1]:/tmp /tmp/mnt`
79+
80+
#### Using vsock
81+
82+
Similarly to above, Linux [vsock](https://man7.org/linux/man-pages/man7/vsock.7.html) can be used to connect directly to sockets within VMs using `-o vsock=CID:PORT`.
83+
84+
```
85+
# on the host
86+
socat VSOCK-LISTEN:12345 EXEC:"/usr/lib/openssh/sftp-server",nofork
87+
# on the clientside
88+
sshfs -o vsock=2:12345 unused_host: ./tmp
89+
```
90+
5891
## Installation
5992

6093

0 commit comments

Comments
 (0)