Ubuntu: How can I mount a SMB share exactly like Nautilus does it?


I have an...interesting problem. You see, I have a SMB share on a network that I would like to mount locally. When I use Nautilus to mount it, everything works perfectly. However, I need to configure the system to run without a GUI, meaning that I can't use Nautilus and instead must create an fstab entry or something similar.

However, when I try to mount the share using the following fstab entry:

//ip.address.goes.here/sharename /path/to/mountpoint cifs  username=user,password=pass,iocharset=utf8,sec=ntlm 0 0  

The share mounts, but the permissions are seriously messed up and prevent me from doing anything.

I know that the share can be mounted properly, as Nautilus does it. My question is, how does Nautilus do it?


Nautilus uses the Gnome Virtual File System (gvfs) to mount devices. In a system that's already running a gvfsd daemon you can initiate a mount manually using the gvfs-mount command e.g.

gvfs-mount smb://ip.address.goes.here/sharename  

which should cause a link to the share to appear in the Nautilus sidebar; the actual mountpoint should appear in the filesystem at /run/user/<UID>/gvfs (or $HOME/.gvfs on earlier versions).

I'm not sure that will be an option in a truly headless environment: I suggest you create a new question detailing your exact issues with the fstab method.

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »