It’s actually quite easy!
In Debian you will have to install smbfs. Some distros install this package by default. First create a mount point to which we will refer to as /mountpoint from this point forward.
mount -t smbfs -o username=<username>,password=<password>,workgroup=<workgroup/domain> //servername/share /mountpoint
If you don’t want to type your password in the comman then don’t. Remove password=<password> and you will be asked to enter it once you hit enter. To use local credentials use the server name in <workgroup/domain> and to use domain credentials use the domain name. Username must match the domain or server you are authenticating against.
You can also mount admin shares. Instead of //servername/share use //servername/<driveletter>$
You can ultimately auto mount remote shares during boot by adding those lines to your fstab, but if your Linux box is not a member of the domain and can’t authenticate mount process will fail unless you have smbfs authenticate automatically. This is not the safest way of auto mounting shares in Linux as you are going to store your password in a text file. As precaution you can make the file accessible to root only.
To do so, add this line to your fstab:
//servername/sharename /mountpoint smbfs auto,credentials=/root/.passfile,uid=1000,umask=000,user 0 0
/root/.passfile is where you will store your network passwords. Create it and add the credentials:
Then add the following lines:
To make the file readable by root only:
chmod 600 /root/.passfile
Once you’re done with all this, go ahead and mount the shares:
Remote share will be mounted automatically after every reboot.