Mount a SAMBA share and create symbolic link

7

3

I develop web-apps using ubuntu (jaunty) but have a need to work on a site that must be hosted on windows. I've setup virtualbox with a winxp32 installation and shared the entire hard disk. My goal is to be able to use eclipse(pdt) in ubuntu to create a new php project that references my wwwroot folder of the winxp installation.

I've got everything setup so I can browse the VM via smb://192.168.../www/ with no problem. However, I'm stumped when it comes to setting up the project in eclipse since it's outside of the normal workspace. I tried tinkering with creating a symbolic link in the workspace to my share but I'm not sure how to do that.

I've tried to create a symlink to the share but ubuntu says it's broken

ln -s smb://192.../www/ windows

I've read that I need to mount the shared drive first then symlink that but don't have any experience with that.

Mike B

Posted 2009-10-29T14:51:52.423

Reputation: 195

Answers

9

You can't symlink a network share like that. Symlinks only work between files/directories on the same computer (and hardlinks are even more restrictive - they need to be on the same filesystem/partition).

First make sure the smbfs package is installed on Linux:

sudo apt-get install smbfs

Or in >14.04:

sudo apt-get install cifs-utils

Now create a share on the Windows machine. Call it "www" or something.

Now make a directory on Linux, let's say it's called "windows".

Now mount the Windows share on Linux:

sudo mount -t smbfs 192.168.x.x/www windows

Or try "cifs" instead of "smbfs" if something is not right.

At this point, everything you see in the "windows" directory is the stuff actually on the "www" share on Windows. You can symlink the "windows" directory if you wish (but you could create it directly in the place you want it so no symlink is required):

ln -s windows /some/arbitrary/destination

Finally, read this:

# MountWindowsSharesPermanently

Florin Andrei

Posted 2009-10-29T14:51:52.423

Reputation: 919

3Thanks Florin. I had to tweak the mount command and add // in front of the IP, after that it worked like a charm. Much thanks. – Mike B – 2009-10-29T17:57:51.590

i think you actually want mount -t cifs if it's available. smbfs is a good fallback but i think cifs is generally the preferred of the two. – quack quixote – 2009-11-02T03:33:58.680

You may have to run mount.cifs instead of mount -t cifs. – indiv – 2014-02-08T01:41:45.287

3

One quick solution is to access the share with nautilus (going to Network or manually entering smb://...). After the share is accessed recent versions of ubuntu automatically mount the file share in the directory ~/.gvfs. This is a regular file system directory that can be soft-linked using ln -s.

alfplayer

Posted 2009-10-29T14:51:52.423

Reputation: 4 523