Setup Samba Server

Setup Samba Server in container

sudo docker run -d --name samba \
  -e USERID=0 \
  -e GROUPID=0 \
  -p 137:137/udp \
  -p 138:138/udp \
  -p 139:139 \
  -p 445:445 \
  -v /data:/data \
  dperson/samba \
  -n \
  -u "username;password" \
  -s "shared;/data;no;no;no;username"

Note

  • -n enables smbd
  • port 137, 138 are required if you need to use smbd to enable auto discovery.
  • use id command in Linux to check your user id.

Login to Samba Server from MacOS

  • Click Command + K to open the Connect to Server dialog.
  • Type smb://ip/shared, then Connect

Login to Samba Server from Windows

  • Open Add Network Location (添加一个网络位置) in This PC(此电脑)
  • Type \\ip\shared

Backup the data

rsync -av --delete user@ip:/data ~/backup

Resources