Thursday, August 14, 2008

Access Windows directories over network from Linux

At work I have an Active Directory domain and most of my systems are Windows XP clients of this domain. I also have a Red Hat Enterprise network that uses NIS. At my desk, I have a machine that dual boots Vista and Fedora 8. And of course I have VMWare guests on each one. Anyway.....

So I'm on my Fedora box and I simply want to copy a file to the Windows 2003 SBS file server. I have created a shared dir on the server, but how to access it? There are several ways.

First, the GUI way

Click anywhere in a blank space on the X desktop and then hit Alt+F2 on your keyboard. This will bring up the "Run Application" dialog box. Type this in the box:
smb://your_windows_username@IP_address_of_server/shared_dir_name


You can also use the fully qualfied host name if you like. But for the sake of accuracy, I went with IP address. So let's say you have a machine with the IP address of 192.168.1.10, your Windows username is "JimSmith2001" and the name of the shared directory is "backup". Then you could type this:
smb://JimSmith2001@192.168.1.10/backup


Then just click on "Run" and enter your password when it prompts you. Make sure the domain is entered properly. If your domain name is hello.com, then put in HELLO for the domain name.

Next is the CLI way

Just type this:
$ sudo mkdir -p /winserver/backup
$ sudo mount -t cifs -o username=JimSmith2001,password=JimSmithsPassword //192.168.1.10/backup /winserver/backup


Basically you are making a directory to mount to, and then simply mounting the remote Windows directory to it. You can replace cifs with smbfs if the above doesn't work. I think the smbfs is no longer supported though (or something like that). You'll have to research that on your own. But hopefully this will get you started. Good luck!


...