Accessing a Windows share from Linux
So I recently started working on a new WebCenter Sites project and found myself needing to run some *nix shell scripts locally, but unfortunately for me I do my Java development on a Windows 7 machine. Blasphemous I know. Anyhow I happened to have a Linux VM sitting around that I could use to run any *nix scripts I needed. I found myself wanting to keep the files and folders I need for my development environment on my Windows 7 host, so I decided to see if I could access and run unix scipts that act on files/folders living on my Windows 7 host. Here are few simple steps to utilizing this setup.
First, you'll need to create a share on your Windows host by right clicking on the folder you want to share and clicking properties. In the sharing tab click 'Share' and keep the share path handy.
Now open a Terminal window and create the directory /mnt/windows in your in your environment, in my case a Linux VM. This is the mount point we'll use for the share.
Next, you'll need to log into your linux VM and switch to root if necessary. On my Fedora Core 14 VM I issue a "su -" and type in my root password when prompted. We'll be editing the file /etc/fstab to get access to the Windows share we just created when the VM starts up. Edit the file /etc/fstab by opening it in your favorite text editor. This is where I got tripped up. Other resources on the web pointed me to Samba (smbfs) and Samba client but it's much simpler than that. Windows implements something called CIFS. The Common Internet File System (CIFS) is a network protocol which allows a client to manipulate files just as if they were on the local computer. Operations such as read, write, create, delete, and rename are all supported – the only difference being that the files are not on the local computer and are actually on a remote server. Most flavors of linux support this protocol so that linux can play with windows based machines. Add an entry like that depicted in the screen grab below.
The path //192.168.1.2/Users/Mitul/WCS11gR1 is the path to the share, /mnt/windows is the mount point we just created, cifs is the protocol to use and the rest is pretty self explanatory, enter your user name and password for the share where there are blanks in the screenshot above. Then save and close the file.
Next issue a "mount -a" which will force the terminal to mount all drives listed in /etc/fsatb. Once that's done, cd to the share directory which should now be accessible at the mount point /mnt/windows. Just make sure you have the right access levels for the account you are using from linux to ensure you can read and write to the share!
I hope you found that useful. Until next time!