header image
under construction image

This website is still under construction.

Blog

Simple SMB Server Setup Using Docker

Preface #

Setting up a SMB server on Linux is a pain, and I don’t want to spend time configure it when I just want to transfer some malware or executable for analysis to my windows virtual-machine and shut it down completely.

I once tried to configure samba and I just couldn’t get it to work the way I wanted it to be and gave up (most likely due to the fact that I’m lazy and I didn’t wanted to read documentation). I decided to just use a simple HTTP server for transferring files and it worked flawlessly.

Recently I wanted to do some gaming and play some old video games. I decided to use windows 7 since it’s lightweight and don’t have as much bloatware as the windows 10 and 11. After installing the games, I encountered some issues with DirectX (classic, am i right?) and had to transfer some DLL files to the virtual-machine.

I didn’t want to install virtiofs drivers and share a folder so I decided to just roll with the simple HTTP server, but it turned out to be very slow because I had to download different DLL’s and test them one after another (If you’re wondering why didn’t I just connect my VM to the internet and download them directly it’s because I didn’t wanted to and internet explorer sucks!).

So I had this idea that why not just create a docker container with SMB and configure it for these kind of situations. Before I write it myself though just like any other sane person I decided to search the internet to see if someone already wrote such thing and It turned out that there is already a pre-configure samba docker container that I can just pull and run.

Running The Container #

It turns out running this thing is pretty simple. All I had to do was to create a shared directory in the container (i.e. Volume) and pass some argument to the container to share that directory.

docker run -it --name samba -p 139:139 -p 445:445 \
	-v $YOUR_SHARED_DIRECTORY:/mount \
	-d dperson/samba -p \
	-s "public;/mount"

In this case I’m creating a public share, which is basically the volume that I mounted inside the container and by default it’s read-only and guest are allowed.

After setting this up, all I had to do was to just connect to the smb server through the windows file explorer and voilà, everything was working as expected!

What About Users, Permissions and Workgroups? #

The container support complex shared directories, permissions, workgroups, and more… I highly recommend you to read the project README specifically the Configuration section for more information.