Skip to content

Samba

Ahmad Hadidi

Commands below use these values. Click any highlighted value in a code block to change it. Saved in this browser only.

Container

This guide

Also uses your values: Template folder, Bridge, Gateway, CT disk storage, Data folder on the host

Prerequisite

Mounting and User mapping

Install

Create the CT

Proxmox host
{
read -rs -p "Root password for the new CT: " PW; echo
pct create \
200 \
/mnt/pve/evo/template/cache/alpine-3.24-default_20260714_amd64.tar.xz \
--hostname samba \
--cores 1 \
--memory 128 \
--net0 name=eth0,bridge=vmbr0,firewall=1,gw=192.168.0.1,ip=192.168.0.200/24,hwaddr=DE:AD:DE:AD:02:00,type=veth \
--rootfs local-lvm:0.5 \
--mp0 /mnt/pve/evo/data,mp=/data \
--unprivileged 1 \
--ignore-unpack-errors \
--ostype alpine \
--password="$PW" \
--start 1
unset PW
}

Enter the CT

Proxmox host
pct enter 200

Install Samba

In CT
apk update && apk upgrade
apk add samba

Edit the Samba config file

In CT
cat >> /etc/samba/smb.conf <<'EOF'
[storage]
   comment = Network Shared Folder by Samba Server on Alpine
   path = /data
   force user = samba
   force group = samba
   create mask = 0664
   force create mode = 0664
   directory mask = 0775
   force directory mode = 0775
   public = yes
   read only = no
   browseable = yes
EOF

After configuring

In CT
mkdir -p /data
addgroup --system samba
adduser -G samba -H -D -s /sbin/nologin samba
chown -R samba:samba /data
chmod -R g+w /data
rc-update add samba default
rc-service samba start
service samba status

Samba password

In CT
smbpasswd -a samba

Update

Update Samba

In CT
apk upgrade samba
rc-service samba restart

Remove

Delete the CT

Proxmox host
pct stop 200
pct destroy 200