Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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?

share|improve this question
    
Similar Q/A for Debian –  Mike T Feb 24 at 9:52

7 Answers 7

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
share|improve this answer
    
Beautiful! Linux has an incredible amount of features! I wonder what is the way to learn such details though... Thanks! –  texnic Apr 5 '11 at 7:57
    
it seems that the newest Ubuntu puts the mounts in ~/.cache/gvfs/ instead. –  ImaginaryRobots Mar 10 '12 at 17:55
4  
why do they change it every version? –  waspinator Mar 25 '13 at 1:47
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 at 6:33
1  
$XDG_RUNTIME_DIR == /run/user/$(id -u) : on (14.04) –  Tom Nov 28 at 16:55

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. Theres nothing wrong with mounting the directory in /home/$user/mount/someshare)

enter image description here (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 

(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 wont hang during boot trying to poll and mount that share.)

share|improve this answer
    
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 '11 at 12:31
    
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 1:38

On Ubuntu 12.04 I'm running:

~/.gvfs/[SHARENAME]

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

share|improve this answer

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

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

share|improve this answer

On 12.10 you can find the location at

/run/user/USERNAME/gvfs/
share|improve this answer
up vote 0 down vote accepted

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
share|improve this answer

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 
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.