Bash script to mount SMB drive

I used to have my working directory on my home NAS with Samba file sharing. Below script helped me to avoid entering mount command and openvpn command every time I login into my computer.

cifs-utils must be installed on linux system to mount a SMB share using mount.cifs. cifs-utils can be installed using below command:

$ sudo apt-get install -y cifs-utils

echo "Enter user for shared folder"
read shareuser
echo "Enter share password"
read sharepass

echo $shareuser
echo $sharepass

mount.cifs //<host>/<Name of SMB share> /root/Desktop/<Folder for mount> -o username=$shareuser,password=$sharepass
cd /root/Desktop/<Folder for mount>
openvpn OS*

I found this article “Install cifs-utils for SMB client” helpful if you want to mount Samba shares when system starts.