Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

GitHub

This documentation is part of the "Projects with Books" initiative at zenOSmosis.

The source code for this project is available on GitHub.

Technical Specifications

Relevant source files

This page provides reference information for all technical specifications used in sshfs-mac-docker, including port numbers, file paths, protocol versions, user IDs, permissions, and configuration parameters. This is intended as a quick reference for developers and system administrators who need precise technical details.

For detailed explanations of how these specifications are applied in practice, see Configuration Reference. For architectural context explaining why these specifications were chosen, see Architecture.

Network Specifications

Port Configuration

The system uses two standard SMB/CIFS ports that are exposed from the container to the macOS host:

PortProtocolPurposeBindingExposure
139TCPNetBIOS Session Service127.0.0.1:139Localhost only
445TCPSMB over TCP (Direct hosting)127.0.0.1:445Localhost only
22TCPSSH (outbound from container)N/ARemote connection

The port mappings are configured via Docker run command as specified in README.md31:

-p 127.0.0.1:139:139 -p 127.0.0.1:445:445

Both ports are exposed in the Dockerfile at Dockerfile27:

EXPOSE 139 445

Network Architecture Diagram

Sources: README.md31 README.md34 README.md:57-61 Dockerfile27

Container IP Discovery

The container IP address is dynamically assigned by Docker and must be discovered at runtime using:

This command is documented in README.md60

Network Limitation: The SMB client on macOS cannot connect using localhost or 127.0.0.1 despite the port forwarding. Connections must use the container's internal Docker IP address (e.g., 172.17.0.2), as noted in README.md57

Sources: README.md:57-61

Filesystem Specifications

Directory Structure

The container uses a specific directory hierarchy to integrate SSHFS mounts with Samba shares:

PathTypePermissionsOwnerPurpose
/remoteDirectoryDefault (created by mkdir)rootSSHFS mount point
/samba-shareDirectory777 (rwxrwxrwx)rootSamba share root
/samba-share/remoteSymbolic LinkN/ArootLink to /remote

Sources: Dockerfile12 Dockerfile15 Dockerfile21 Dockerfile30 smb.conf11 README.md49

Permission Specifications

ComponentPermissionOctalSpecification
/samba-share directoryrwxrwxrwx0777Dockerfile21
SSHFS mounted filesControlled by mount optionsN/ASee SSHFS Mount Options
Samba share create maskrwxrwxrwx0777smb.conf17
Samba share directory maskrwxrwxrwx0777smb.conf18

The broad permissions on /samba-share are necessary because the Samba service must write to this directory on behalf of guest users, which are force-mapped to sshuser via smb.conf19

Sources: Dockerfile21 smb.conf:17-19

User and Group Specifications

User Account

A single non-root user account is created during image build:

ParameterValueSource
UsernamesshuserDockerfile9
PasswordsshpassDockerfile9
UID1000 (default)Implicitly assigned by useradd -m
GID1000 (default)Implicitly assigned by useradd -m
Home Directory/home/sshuserCreated by useradd -m flag

The user is created via: Dockerfile9

useradd -m sshuser && echo "sshuser:sshpass" | chpasswd

User ID Mapping

Sources: Dockerfile9 smb.conf4 smb.conf19 README.md49

Protocol Specifications

SMB/CIFS Protocol

Configuration KeyValueSourcePurpose
workgroupWORKGROUPsmb.conf2NetBIOS workgroup name
securityusersmb.conf3Security mode
map to guestbad usersmb.conf4Map unknown users to guest
client min protocolSMB2smb.conf7Minimum client protocol version
server min protocolSMB2smb.conf8Minimum server protocol version
server stringSamba Server %vsmb.conf5Server identification string
netbios namesambaserversmb.conf6NetBIOS server name

The protocol enforcement prevents fallback to SMB1, which has known security vulnerabilities.

Sources: smb.conf:1-9

SSH Protocol

ParameterValueNotes
Port22 (default)Standard SSH port
ProtocolSSH-2Used by sshfs command
AuthenticationUser-specifiedPassed via user@host syntax
Connection TypeFUSE-basedFilesystem operations over SSH

The SSH connection is established by the sshfs command as documented in README.md49

Sources: README.md49

SSHFS Mount Specifications

Required Mount Options

The following options must be specified for proper system operation:

OptionValuePurposeSource
allow_otherFlagAllows non-mounting user (Samba) to access mountREADME.md52
uid1000Sets file ownership to sshuserREADME.md53
gid1000Sets group ownership to sshuserREADME.md53

Complete mount command syntax from README.md49:

Critical Dependencies:

  • allow_other requires user_allow_other enabled in /etc/fuse.conf (Dockerfile24)
  • uid=1000,gid=1000 must match the UID/GID of sshuser for write access
  • Without these options, the mount will be read-only or inaccessible to Samba

Sources: README.md:49-53 Dockerfile24

FUSE Configuration

FUSE (Filesystem in Userspace) requires specific configuration to enable cross-user access:

Configuration FileSettingValuePurpose
/etc/fuse.confuser_allow_otherEnabledPermits non-root users to use allow_other flag

This is configured via Dockerfile24:

Without this configuration, the allow_other mount option would be rejected by FUSE.

Sources: Dockerfile24

Container Runtime Specifications

Required Privileges

The container must run with elevated privileges:

FlagValuePurposeSource
--privilegedRequiredEnables FUSE filesystem operationsREADME.md31

The privileged mode is necessary because FUSE requires access to /dev/fuse and the ability to perform mount operations, which are restricted in standard containers.

Sources: README.md31

Container Command

The container runs Samba as its primary process:

smbd --foreground --no-process-group --debug-stdout
ArgumentPurpose
--foregroundRuns smbd in foreground (required for Docker)
--no-process-groupPrevents process group creation
--debug-stdoutSends debug output to stdout

This is specified in Dockerfile33

Sources: Dockerfile33

Samba Share Specifications

Share Configuration

The share named "SSHFS Share" has the following configuration from smb.conf:10-20:

ParameterValuePurpose
path/samba-shareRoot directory of share
writableyesAllows write operations
guest okyesPermits guest access
guest onlyyesForces guest authentication
read onlynoExplicitly enables writing
browseableyesShare visible in network browser
create mask0777Default permissions for new files
directory mask0777Default permissions for new directories
force usersshuserAll operations performed as this user

Sources: smb.conf:10-20

Package Specifications

Installed Packages

The following packages are installed via apt-get in Dockerfile:5-6:

PackagePurposeVersion
sshfsSSHFS client for mounting remote filesystems over SSHLatest from Ubuntu repository
sambaSMB/CIFS server for file sharingLatest from Ubuntu repository

Base Image

SpecificationValue
Base Imageubuntu:latest
SourceDockerfile2

Sources: Dockerfile2 Dockerfile:5-6

Command Reference Summary

Docker Commands

CommandPurposeSource
docker build -t docker-sshfs .Build container imageREADME.md22
docker run --privileged --name docker-sshfs -p 127.0.0.1:139:139 -p 127.0.0.1:445:445 docker-sshfsStart containerREADME.md31
docker exec -it docker-sshfs bashAccess container shellREADME.md41
docker inspect --format '{{ .NetworkSettings.IPAddress }}' docker-sshfsGet container IPREADME.md60

SSHFS Commands

CommandPurposeSource
sshfs -o allow_other,uid=1000,gid=1000 user@host:path /remoteMount remote filesystemREADME.md49
fusermount -u /samba-shareUnmount filesystemREADME.md76

Sources: README.md22 README.md31 README.md41 README.md49 README.md60 README.md76

Platform Requirements

RequirementSpecificationNotes
PlatformOrbStackHighly recommended for network compatibility
AlternativeDocker DesktopRequires network routing modifications
macOS VersionAny version supporting DockerNo macFUSE required

The recommendation for OrbStack over Docker Desktop is documented in README.md9 due to networking compatibility issues with Docker Desktop's SMB client integration.

Sources: README.md9

Error Messages and Codes

Known Error Conditions

Error MessageCauseResolution
fusermount: failed to unmount /samba-share: Device or resource busySamba share still mounted on macOSUnmount from Finder first, or stop container

This error is documented in README.md:82-85

Sources: README.md:82-85