AlpineLinux 3.6: Install cifs-utils for SMB client

Table of Contents

1 Install cifs-utils

Install cifs-utils package.

$ sudo apk add cifs-utils

2 Mount SMB with mount.nfs

Mount SMB with mount.nfs to /mnt directory.

$ SMB_USERNAME=foobar$ SMB_PASSWORD=foobar$ SMB_SERVER=”//”$ sudo mount -t cifs -o username=${SMB_USERNAME},password=${SMB_PASSWORD} “${SMB_SERVER}” /mnt

3 Manage username and password with credentials option

The credentials option authentication via file.

$ sudo mkdir /etc/samba$ cat <<EOF | sudo tee /etc/samba/credentials > /dev/nullusername=${SMB_USERNAME}password=${SMB_PASSWORD}EOF$ sudo chmod 600 /etc/samba/credentials$ sudo mount -t cifs -o credentials=/etc/samba/credentials “${SMB_SERVER}” /mnt

4 Mount SMB on boot

Add mount entry to /etc/fstab. For avoiding mounting SMB before network initialization, you need to add _netdev option.

$ sudo rc-update add netmount$ SMB_OPTION=”credentials=/etc/samba/credentials,_netdev”$ echo “${SMB_SERVER} /mnt cifs ${SMB_OPTION} 0 0” | sudo tee -a /etc/fstab

Android | Linux | SDL - Narrow Escape