Windows Ubuntu – How to Mount a SAMBA Share and Create Symbolic Link

mountsambaUbuntuwindows

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.

Best Answer

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

Related Question