Mount CIFS (SMB) on Linux using /etc/fstab
Mount using /etc/fstab
The below /etc/fstab entry can mount CIFS shares during boot://192.168.1.2/myresource /mnt/mysource cifs defaults,username=myuser%mypassword
The below /etc/fstab entry can save the credential under another file which is more secure:
//WindowsHost/Sharename /LocalMountPoint cifs username=,credentials=/etc/cifsauth{any file},domain=my_domain 0 0
Format of credentials file (/etc/cifsauth)
username=
password=
Mount using command line
# mkdir /mnt/cifs
## using servername
# mount -t cifs //server-name/share-name /mnt/cifs -o username=shareuser,password=sharepassword,domain=YOUR_DOMAIN
## You may substitute YOUR_DOMAIN with your HOSTNAME if you don't have a domain or you are using local account.
## You can also use IP address
# mount -t cifs //192.168.1.1/share-name /mnt/cifs -o username=shareuser,password=sharepassword,domain=YOUR_DOMAIN
##Mount with read-write
mount -t cifs //server-name/share-name /mnt/cifs -o username=shareuser,password=sharepassword,domain=YOUR_DOMAIN,rw,file_mode=0777,dir_mode=0777
References:
References:
Comments