65

Please note: I am two weeks old in Linux. I have found a lot of answers to this question on the internet, tried many, but all failed one way or another. Therefore I dare to ask once again in the hope that someone here could explain it simply :)

Pre-conditions:

In my institute, we have a Samba server. In Windows, it is accessed by going to \\xyz.220.131.233\ and entering the login abc and the password def.

In Ubuntu, I was able to do exactly the same using Nautilus, pressing Ctrl+L and entering smb://xyz.220.131.233/. It then asks for the login and the password and connects. I can even drag a folder from here to the 'Places' and have a shortcut to the remote location.

So far so good. I've just installed Matlab and want to open this remote location. Trying to cd to smb://xyz.220.131.233/ returns

Cannot CD to smb://xyz.220.131.233 (Name is nonexistent or not a directory).

A Mac user in my group told me I first mount the location, but he didn't know how to do it.

Is it true and how do I do it?

Braiam
  • 67,791
  • 32
  • 179
  • 269
texnic
  • 1,223

9 Answers9

89

In most cases:

$XDG_RUNTIME_DIR/gvfs

14.04:

/run/user/$(id -u)/gvfs

12.10:

/run/user/<username>/gvfs

12.04:

Since 12.04 the folder of mounted samba share is:

~/.cache/gvfs

11.10 and older

You can learn how to mount - it will sure works. But I think this is an easier solution for you: Nautilus mount smb partitions at ~/.gvfs (where ~/ means /home/user_name/ - example: /home/desgua/.gvfs).
You just have to navigate to there:

cd ~/.gvfs
Pablo Bianchi
  • 15,657
desgua
  • 32,917
7

Another option here, while not directly related to having mounted the directory in nautilus is to mount the location from the command line.

However, to mount samba volumes, you have to have CIFS support.

sudo apt-get install cifs-utils

From here, you have the option of where you want to mount the location. There are TWO "standards" of sorts for this. If you want the location to show up in the Places menu, you would mount it in /media. If not, you would mount it in /mnt (only to follow the common namespace for mounted volumes. There’s nothing wrong with mounting the directory in /home/$user/mount/someshare)

Illustration of the mounted location in the Places menu

assuming that /media/myshare exist, you would achieve this by issuing the following command:

sudo mount -t cifs -o user=abc,password=def //xyz.220.131.233 /media/myshare

Side note

You can accomplish this automagically by appending the following string to your /etc/fstab configuration:

//xyz.220.131.233 /media/SambaMount cifs username=abc,password=def,rw,user,noauto 0 0

Notice the noauto flag, this will keep the volume from being mounted at boot, so when you're no longer at your workplace, it won't hang during boot trying to poll and mount that share.

David Foerster
  • 36,264
  • 56
  • 94
  • 147
lazyPower
  • 5,371
  • Sorry for not replying sooner, I was distracted by some urgent work and had to switch back to Windows for a while. This suggestion somehow doesn't work: I am getting a 'Retrying with upper case share name. mount error(6): No such device or address' error. Something similar is described at https://bugzilla.redhat.com/show_bug.cgi?id=195264 – texnic Apr 12 '11 at 12:31
  • 1
    I've realised that was probably my mistake. I should have mounted //xyz.220.131.233/foldername rather than the whole server. After correcting for this, I don't get an error any more and can see the /myshare folder appeared in Places in Nautilus. However, when trying to browse it, I get 'The folder contents could not be displayed. You do not have the permissions necessary to view the contents of "myshare"'. What's wrong? – texnic Apr 12 '11 at 12:42
  • 1
    Check that you have permissions to access the resource by both the user on the remote system that your using to mount it (in the mount string) as well as the user account used to create the mount on your local machine. – lazyPower Apr 12 '11 at 17:48
  • Aha, slowly progressing :) If I launch Nautilus with sudo, I can browse the /myshare location. Now how do I mount it in such a way that I can access it as a normal user (texnic)? I can access the remote location as a normal user, as far as I understand, since I can browse to smb://xyz.220.131.233/foldername in Nautilus launched without sudo. And, on the other hand, why do I get 'Permission denied' if I try to execute 'cd /media/myshare' and at the same time I get 'command not found' for 'sudo cd /media/myshare'? – texnic Apr 13 '11 at 10:27
  • You'd have to add the user flag in your mount options, either via fstab or during the issued mount command. eg: -o user – lazyPower May 13 '11 at 01:38
  • After reading http://www.tuxfiles.org/linuxhelp/fstab.html, I also thought so but it seems not to be necessary. See my answer below. – texnic Jun 08 '11 at 16:13
  • ERROR: wrong fs type, bad option, bad superblock on smb://computer/dev, missing codepage or helper program, or other error (for several filesystems (e.g. nfs, cifs) you might need a /sbin/mount. helper program) – Nuzzolilo Jan 01 '16 at 20:40
4

in ubuntu 16.04 and vlc 2.2.2 ;

Select media > Open Directory and navigate to /run/user/1000/gvfs/ << ID number (1000) can be vary on your system.

Here you can see the shared folder name and select the folder whichever you want to add in playlist (see picture below)

vlc add dierctory

Videonauth
  • 33,355
  • 17
  • 105
  • 120
xkeshav
  • 579
  • 1
  • 5
  • 19
2

On 12.10 you can find the location at

/run/user/USERNAME/gvfs/
2

On Ubuntu 12.04 I'm running:

~/.gvfs/[SHARENAME]

~/.cache/ only contains a folder gvfs-burn

BuZZ-dEE
  • 14,223
88weighed
  • 690
2

So, not sure if this is the real answer (please comment if in doubt or checked it yourself), but after some struggling together with another Linux colleague I've realised that I actually was not in the users group in my system (nano /etc/group). Upon adding myself to this group (sudo nano /etc/group, adding my name to the users line), I am now able to access the remote directories. My /etc/fstab file has these lines:

//xxx.220.131.233/user  /mnt/rua_user  cifs  username=abc,password=def 0 1
//xxx.220.131.233/all   /mnt/rua_all   cifs  username=abc,password=def 0 1

The rights on the folders look like this (ls -lh /mnt):

drwxrwx---  8 1016 users 0 2011-03-08 11:14 rua_all
drwxrwx--- 25 1016 users 0 2011-05-25 18:21 rua_user
texnic
  • 1,223
1

Follow this page. I followed it to get the same result as what you are looking for.

https://help.ubuntu.com/community/MountWindowsSharesPermanently

NateW
  • 500
1

in some of latest (e.g., 13.XX, 14.XX) ubuntu , you need to go to

/run/user/(USERID)/gvfs/

to find the mounted location. here (UID) is the UID of the account, which can be found by the command

id 
1
ln -s "/run/user/1000/gvfs/smb-share:server=192.168.1.1,share=Name_server/Path_Directory_source_in/Path_file.pdf" /Path_directory_source_out/Path_file.pdf

This is my example of how to make a file link from terminal in Ubuntu.

Use double quotes "" to escape special characters such as spaces

Zanna
  • 70,465
ugreg
  • 11