The current gvfs / libsmbclient process works more or less but there are advantages to using cifs instead and I want to make this as seamless to the end user as possible.
The best way to get started with this is to do a manual temporary mount first to make sure you can connect and then to automate this so using the terminal is not required. I will present this as a series of templates using these variables:
server = the host name, the mDNS host name, or the ip address of the host that contains the desired share.
share = the name of the share that you want to access
uid=1000 = The "1000" is your user id number. You should run the following command to find the uid number for you:
Code: Select all
id
** Make sure cifs is installed:
Code: Select all
sudo apt-get install cifs-utils
--- Place the mount point under /media [will also work in your home directory as in /home/altair/Share]
--- This will induce a udisks response that displays the mount point on the desktop, your file manager, and in your apps.
Code: Select all
sudo mkdir /media/Share
[1a] If the share allows guest access:
Code: Select all
sudo mount -t cifs //server/share /media/Share -o guest,uid=1000
Code: Select all
sudo mount -t cifs //server/share /media/Share -o username=nnn,password=ppp,uid=1000
Code: Select all
sudo mount -t cifs //server/share /media/Share -o username=nnn,password=ppp,domain=something.com,uid=1000
[2a] If the share allows guest access:
Code: Select all
sudo mount -t cifs //server/share /media/Share -o guest,nounix,uid=1000
Code: Select all
sudo mount -t cifs //server/share /media/Share -o username=nnn,password=ppp,nounix,uid=1000
Code: Select all
sudo umount /media/Share
Code: Select all
//server/share /media/Share cifs guest,noauto,user,uid=1000 0 0
//server/share /media/Share cifs username=nnn,password=ppp,noauto,user,uid=1000 0 0
//server/share /media/Share cifs username=nnn,password=ppp,domain=something.com,noauto,user,uid=1000 0 0
//server/share /media/Share cifs guest,nounix,noauto,user,uid=1000 0 0
//server/share /media/Share cifs username=nnn,password=ppp,nounix,noauto,user,uid=1000 0 0
*** When you need access to the share simply access the icon in the file manager or in your application and fstab will do the rest
*** When you are done using it you can use the little mount icon next to the name to unmount it if there is one for your desktop or right click it to unmount it.
Bonus Info:
There are different dialects ( versions ) of smb and by default both smbclient and mount.cifs use smb 1.0 ( aka NT1 ) which is actually very old. To make things more efficient and allow for faster file transfer speeds you can make them match the server by adding another option to your line in fstab: vers. So to use one example of this:
Possible vers values for different servers://server/share /media/Share cifs username=nnn,password=ppp,uid=1000,vers=3.0,noauto,user 0 0
vers = 2.1 FOR Windows 7
vers = 3.0 FOR Windows 10, Linux, and OSX
EDIT: The Linux Kernel starting with 4.13 changed the default CIFS smb dialect from 1.0 to 3.0 so now we have the opposite problem. If version of Windows or samba is very old you need to pass vers=1.0 in the mount command:
Bonus Info II.//server/share /media/Share cifs username=nnn,password=ppp,uid=1000,vers=1.0,noauto,user 0 0
Some but not all NAS devices use a version of samba that can only be described as antique. And in their case another option takes affect: sec. Mount.cifs by default uses ntlmssp which Windows and OSX use as standard but for these nas devices you may need to drop the security level down a notch: sec=ntlm. For example:
There are other options like dir_mode and file_mode that can be used to expand permissions but believe it or not I tried to make this short.//nas/nas-share /media/NAS cifs username=nnn,password=ppp,uid=1000,sec=ntlm,noauto,user 0 0