3

When I browse my local network, I can access the windows drives of a Windows machine without any issue. Everything is visible, shared or not shared folders. I have full permissions.

I notice that accessing a drive from a machine (drive d from machine XYZ), Nautilus makes a mount of that drive. Hovering in Nautilus over the mount point I see: smb://XYZ/$d/ and name of the mount point is: d$ on XYZ. The actual mount point is: ~/.gvfs/d\$\ on\ XYZ/.

Now, my question is. How can I script that without using mount points. Script should do: mount, copy something, unmount.

I require this for a back-up solution using pool rather then push.

Thanks

1 Answer 1

6

Assuming you've already stored all the required users and passwords on the keyring, and the keyring is accessible (it's already unlocked), you can mount on the command line with:

gvfs-mount smb://user@server/sharename

This will mount your share on ~/.gvfs for 12.04, or on /run/user/$USER/gvfs for 12.10.

If the password is not stored on the keyring, or the keyring is locked, you will be asked for the password on the console, and that's not cool for a script.

When you're done, to umount use this command:

gvfs-mount -u smb://user@server/sharename
3
  • 1
    thanks for the answer. However I am not trying to mount a shared driver. As I have said, everything is visible in Nautilus. So will it work with: gvfs-mount smb://XYZ/$d/ ? Actually I'll try it now :)
    – bioShark
    Jan 15, 2013 at 22:23
  • I get Error mounting location: Location is already mounted when I try to run the above command. Of course the drive is not mounted. Not visible in Nautilus and ll ~/gvfs yields nothing
    – bioShark
    Jan 15, 2013 at 22:31
  • Sorry mate. I've just realized that I have misspelled the hostname. It worked like a charm. Thanks
    – bioShark
    Jan 15, 2013 at 22:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .