34

I use Places > Connect to Server... to connect to a Windows share in my work environment (requires Kerberos authentication). When I do so, I can access the Windows share via Nautilus, but I can't figure out how to access the share from the command line without using smbclient.

For example, the share isn't mounted under /mnt or /media. I also looked into ~/.gvfs but that's empty as well.

Is it possible to access the mounted Windows share from the command line without using smbclient?

3 Answers 3

22

You can use:

mount -t smbfs //servername/myshare /mnt/servername/myshare -o username=myself

mount.cifs //servername/myshare /mnt/servername/myshare -o user=username,pass=password
is another option for scripting purposes.

If it doesn't work, try cifs instead of smbfs, aparently cifs works for newer Windows servers, but I've never had to use it.

Where //servername/myshare is the share address, and /mnt/servername/myshare is the mount folder in your system.

Once it's mounted you can access the share at /mnt/servername/myshare via command line.

I found the solution in this Ubuntu Forums: smbclient works, mount -t smbfs doesn't

7
  • CIFS for me had other advantages, too. But it's possible the underlying problems were solved meanwhile. If a share was disconnected due to lost network connectivity, CIFS for me always restored it to the old state (once network was back), while the traditional smbfs left a broken mount behind, which had to be forcefully unmounted and then mounted again ... but take that with a pinch of salt, it's possible that this was solved. Mar 9, 2011 at 0:06
  • I think it has something to do with the fact that the environment I'm in uses Kerberos authentication. If I remember correctly, I tried using both the smbfs and cifs mount commands before, but neither of them supported krb5 (maybe that's changed now...). If I mount the remote drive using the GUI, it only works when I've initialized a Kerberos key with kinit. If the output of klist is empty, the GUI won't work either. I'll try some things later when I'm on the right network and post my findings here. Thanks!
    – Bryan
    Mar 9, 2011 at 14:28
  • I've confirmed that smbfs and cifs still do not support krb5. I've also confirmed that even though the GUI method requires both an active Kerberos ticket and my Kerberos password. If I try it without a Kerberos ticket it will still prompt me for my password but will not mount the share. So if smbfs and cifs still don't support krb5, then what is the GUI using?!
    – Bryan
    Mar 17, 2011 at 16:18
  • 2
    FWIW "smbfs" has become an alias for "cifs" on newer versions of Ubuntu.
    – jelmer
    Mar 26, 2011 at 19:45
  • 1
    This did the trick for me: sudo mount.cifs //servername/myshare /mnt/servername/myshare. It requires cifs-utils package, tested on ubuntu 14.04.
    – Paolo
    Oct 28, 2014 at 19:35
12

The GVFS mount point has changed from one release to the next. On Ubuntu 12.10, it's at /var/run/<username>/<mountname>/.

One way to easily find the path of the mount is by using the "Open Terminal" plug-in.

Install via the software center

You'll need to log out and in for to complete the installation.

Once installed, navigate to the Windows Share folder, click "File", and then "Open in Terminal".

Another way to find the mount is to examine the output of mount. Look for the line that begins with gvfsd-fuse.

1
  • 1
    this is the correct answer to the question, because it doesn't require any new mounts and uses the mount point created by Places->connect to server...
    – anneb
    Oct 29, 2018 at 14:18
2

Go to your home directory, by running: cd ~

Then run: ls .* to list files and directories in it that start with .. This will show you all the hidden directories and config files in your home directory.

Look for the .gvfs directory. You can go into it with cd .gvfs.

That will have all the mount points that you made inside the OS GUI.

And you can brows the mounted drives or shares from these points.

1

You must log in to answer this question.

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