First, make sure that the CIFS mount tool is installed:
sudo apt-get install cifs-utils
Next, edit the /etc/fstab
file and put an entry for each Windows/Samba share that you want to mount.
//server/share /mnt/share cifs credentials=/root/.smbpasswd,file_mode=0666,dir_mode=0777 0 0 | | | | | | | ^--------- Mount Options | | ^-------------- Type of file system (smbfs or cifs) | ^------------------------- Local Mount Point ^---------------------------------------- Windows Share Name
Create the “smbpasswd” file in root's home directory.
echo domainname=mydomain > /tmp/.smbpasswd echo username=myusername >> /tmp/.smbpasswd echo password=mypassword >> /tmp/.smbpasswd sudo mv /tmp/.smbpasswd /root/.smbpasswd chmod 600 /root/.smbpasswd
Replace username and password with your actual parameters. If you have multiple user accounts to multiple shares, you'll want to create a different “smbpasswd” file for each user account.