When using Mono and developing web applications in Visual Studio, it often becomes a pain to keep copying modified files over to your Linux box for testing.

Luckily for us Linux is compatible with Windows file shares via Samba. Samba allows us to mount Windows file shares as if they were folders on your local Linux drive.

Install Samba

You'll fist need to make sure that you have all the Samba files installed on your Linux box. These instructions are for Ubuntu, but should work for most distributions.

On the command line, log in as root using the sudo command:




$ sudo bash


Enter your password when prompted.

Then download and install the required Samba files.




$ apt-get install smbfs


Once that is installed, we can create the file mapping.

Map the Windows Share

First thing to do obviously is share a folder on your Windows computer. For the purposes of this tutorial, I'm going to be making the following assumptions:

  • Your Windows and Linux PC's are on the same network. Use the "ping" command to confirm!
  • The windows computer is called "MYPC" with an IP address of 192.168.0.1
  • The folder I'm sharing is called "Projects"
  • The Windows computer has a user account called "Russell" with a password of "mypassword". This user account must have access to the shared folder!

On our Linux box we're going to create a folder which will become our mount point. A mount point is basically a normal folder that will magically map to the shared folder.

So let's create a mount point folder for our projects share:




$ mkdir /mnt/projects


Now let's mount the windows share into our new mount point:




$ mount -t smbfs //MYPC/projects mnt/projects -o username=russell,password=mypassword


If you get an error on the above command, chances are that you're unable to resolve the computer name of your Windows PC. Try using "ping MYPC" to confirm that you can reach the PC. If you get an unknown host error, you can simply fix the problem by providing the IP address in the mount command used above.

Lets confirm that we can see our files:




$ cd /mnt/projects
$ ls


You should a directory listing of the files on your Windows share.

And that's it, now you can access your windows PC files as if they were part of your Linux file system!

Comments

Comments are closed

I am a software developer / architect currently interested in combining .NET technologies with open-source operating systems. 

I am a member of the open-source BlogEngine.NET development team and focus mainly on ensuring Mono compatibility for the project.

twitter

BlogEngine.NET


At StayUnlimited Cape Town accommodation we help you choose from and book guest houses, self catering apartments, bed & breakfasts, luxury villas and hotel accommodation.