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?

1

9 Answers 9

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
9
  • Beautiful! Linux has an incredible amount of features! I wonder what is the way to learn such details though... Thanks!
    – texnic
    Apr 5, 2011 at 7:57
  • 16
    why do they change it every version?
    – waspinator
    Mar 25, 2013 at 1:47
  • 1
    I'm on 12.04, and it's mounted to ~/.gvfs.
    – T0xicCode
    Jul 23, 2013 at 20:29
  • 2
    14.04 same as 12.10. User as number not name on my system like /run/user/1000/gvfs/smb-share:server=NAS,share=MyShareFolder
    – TiloBunt
    Oct 1, 2014 at 6:33
  • 2
    $XDG_RUNTIME_DIR == /run/user/$(id -u) : on (14.04)
    – Tom
    Nov 28, 2014 at 16:55
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.

7
  • 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 bugzilla.redhat.com/show_bug.cgi?id=195264
    – texnic
    Apr 12, 2011 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, 2011 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, 2011 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, 2011 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, 2011 at 1:38
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

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
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

1

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

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

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

You must log in to answer this question.

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