How to automount CIFS/SMB on Alpine Linux

In order to automatically mount CIFS on boot of an Alpine Linux instance, use a line like this in /etc/fstab:

how-to-automount-cifs-smb-on-alpine-linux.txt
//1.2.3.4/mydrive /mydrive   cifs uid=1000,gid=1000,credentials=/root/.smb-credentials,iocharset=utf8,noperm 0 0

with a standard /root/.smb-credentials like this:

smb_credentials_example.ini
user=myuser
password=raatahteiC1veiza8ahno8lu5quook

and run the following command to enable automount on boot:

enable_netmount.sh
rc-update add netmount boot

After a reboot, the filesystem should mount automatically.


Check out similar posts by category: Alpine Linux, Networking