Skip to content

Instantly share code, notes, and snippets.

@bytehow
Last active April 30, 2020 23:17
Show Gist options
  • Save bytehow/07fd265f114d6a536849f9b64857c99c to your computer and use it in GitHub Desktop.
Save bytehow/07fd265f114d6a536849f9b64857c99c to your computer and use it in GitHub Desktop.
Using a containerized samba network file share, and connecting to it from multiple OSes

Starting the containerized samba server

sudo docker run \
  -p 139:139 \
  -p 445:445 \
  -v `pwd`:/mount \
  -d dperson/samba \
  -u 'myuser;mypassword' \
  -s 'myshare;/mount;yes;no;no;myuser;myuser;myuser'

Linux

$ sudo su -c "echo '//<host>/myshare /mnt/myshare cifs username=myuser,password=mypassword,noauto,rw,users 0 0' >> /etc/fstab"
$ sudo mkdir /mnt/myshare
$ sudo chown -R $USER:$USER /mnt/myshare
$ mount /mnt/myshare

Windows

net use S: \\<host>/myshare /USER:myuser mypassword /PERSISTENT:YES

macOS

$ mkdir ~/share
$ mount -t smbfs //myuser:mypassword@<host>/test ~/share
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment