Skip to content

jzombie/sshfs-mac-docker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 

Repository files navigation

sshfs-mac-docker

Experimental repo to provide SSHFS to Mac WITHOUT installing macFUSE and patching the kernel with a custom kext.

Remote filesystem is mounted in container via SSHFS and exposed to Mac via Samba.


Note: It is highly recommended to use OrbStack. Docker Desktop will not work for this without modifying the network routing.


Why Samba instead of Volume Mounts?

The standard Docker volume mounts won't work for this purpose because they are designed for local file systems and do not natively support SSH-based file system connections. The sshfs-mac-docker solution uses SSHFS to overcome this limitation, allowing remote file systems to be mounted inside Docker containers as if they were local volumes, which is not achievable with Docker's standard volume mounting features.


Build the container

docker build -t docker-sshfs . 

Start the container

In one terminal shell, run:

docker run --privileged --name docker-sshfs -p 127.0.0.1:139:139 -p 127.0.0.1:445:445 docker-sshfs

Samba is configured to listen on ports 139 and 445 and is accessible only from localhost.

Mounting Remote Filesystem

In another terminal:

docker exec -it docker-sshfs bash

You'll be dropped into the container at this point.

Run (replacing user@host:path with your SSHFS endpoint):

sshfs -o allow_other,uid=1000,gid=1000 user@host:path /samba-share

allow-other is needed to be able to access via mac samba uid=1000,gid=1000 is needed for write-access (otherwise, it will be read-only if omitted)

Connecting to Samba share in container

  1. Find Docker IP of container (localhost doesn't seem to work for this)
docker inspect --format '{{ .NetworkSettings.IPAddress }}' docker-sshfs
  1. Navigate to Finder -> Go -> Connect to Server

  2. Enter `smb://ip-of-docker-container``

    If all goes well, connect as Guest.

  3. Open Finder, navigate to Network tab, find the IP of the Docker container, and you should now have access to remote files

Unmounting Remote Filesystem

If wanting to unmount the SSHFS endpoint (without stopping the container):

fusermount -u /samba-share

If getting message

fusermount: failed to unmount /samba-share: Device or resource busy

...unmount the drive from Finder (or just stop the container)

Not wanting Docker?

Maybe this will work instead: https://github.com/macos-fuse-t/fuse-t

About

SSHFS on macOS without macFUSE or kernel extensions.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published