Saturday, July 12, 2008

Access linux shares from windows

The cute-looking Tux had a problem. Everyone thought Tux disliked Windows and therefore wouldn't talk with anything that had 'Win' in it. This thought spread around quite a bit, and therefore most Windows users would have no truck with tux.
But getting Windows to recognise a Linux machine or for that matter getting Linux to recognise Windows-based computers in a network is as simple as configuring your network in Windows.
See-through LinuxWhile Windows uses the popular Network Neighborhood to view other machines, Linux allows other Windows users to view a Linux-PC using a utility called Samba. Samba emulates the Linux machine as a Windows machine and thus allows you to share resources on the hard drive along with the appropriate security roles. Using Samba, it is also possible to share printers or use Windows-based network printers.
However, there are some basic steps that need to be performed before you get your Windows and Linux computers to talk to each other. For example, you need to set the security modes, specify the share names, etc.
Samba for startersBefore starting off the installation and configuration of Samba on a Linux computer, make sure you have the network components set up perfectly. You can find Samba in almost any Linux distribution media. In fact, it is usually installed when you install a Linux distribution. In case the Linux distribution that you have installed or used does not have Samba, you can always download the latest release from the Samba site.
The configuration of Samba doesn't vary from distribution to distribution, so let's see how you can get it right in Red Hat. Before installing any package, you have to be logged in as root. So, type su root at the command prompt or use the X interface to log off from the normal user to root. For installing the packages, Red Hat users can use gnorpm from X. Otherwise, those comfortable with the command line can install Samba using the following command:
rpm -ivh samba-2.i386.rpm
In case your distribution gives you an error that says missing dependencies while installing Samba, install the missing components first or else Samba will not get installed. Once you have successfully installed the Samba daemon on your system, you can move on to configuring it.
Samba sharesFor Windows-based PCs to view your Linux machine, you have to configure Samba. You can either use the graphical interface or manually edit the Samba configuration file. (/etc/samba/smb.conf). Start up your favourite text editor, and open the smb.conf file. There are various sections that you can change depending on your needs, but the most basic is where you just specify the share name, the path and the user rights. Go to the section marked as
[tmp] comment = Temporary file space path = /tmp read only = no public = yes
The [tmp] name denotes the name of the share that will be displayed when anyone tries to access your machine through the Network Neighborhood. The comment tag describes the information about the share [tmp]. The most important line is the one about the path, where you specify the folder which has to be shared. Ensure that the folder has the appropriate security settings to allow others to read or write to it. The read only = no line means that people can also write on the share. The same read only = tag can be made yes to make it only readable by users. The public = yes tag makes the share available for all the public around to see. Similarly, public = no will not allow everyone to access the share; only the particular user will gain access. At the same time, in the security section, change the security to share if you are not using Windows NT domain.
If working with text-based commands is too difficult, then there are graphical interfaces that also allow you to configure Samba. The KDE desktop environment, for instance, has a utility called Ksamba. GnoSamba is a Gnome program for configuring your smb.conf and other Samba files accordingly. This helps in creating and editing Samba shares very efficiently and also easily. There are many other Samba utilities that ease your task and give you more control over the shares.
Maps of the worldAfter you have finished installing and configuring Samba on your Linux distribution, you can go to any machine on your network and see your computer along with the other Windows machines. Like with any other networked computer, you can map the Linux share as a drive. You can access your Linux machine from other *nix systems using smbclient, a Samba client that allows you to connect to a Samba server.
smbclient -L - machine gives you a list of all shares on a particular machine.
smbclient file://testmachine/share allows you to access the shared folder 'share' on a computer called 'testmachine'.
smbmount file://testmachine/share /mnt mounts a share called 'share' from the testmachine computer on a directory called mnt.
If you have smbclient installed on a Windows-based machine, you can use the same commands on that machine too.
Linux in your neighbourhoodTill now, you have seen how your Windows machine can access Linux computers. Even Linux computers can access shares on a Windows PC in an easy way using utilities such as Linneighborhood or XSM Browser. Linneighborhood is a clone of the Windows-based Network Neighborhood and allows users to browse through Windows-based networks. You can mount (map as in Windows) the different Windows shares.
XSMBrowser is another utility for viewing a Windows machine and has an interface similar to that of Netscape Navigator. The installation of XSMBrowser can be done using the Red Hat binaries or by compiling the source.
Lin-Win talkAs you can see, getting Linux and Windows to talk to each other isn't difficult at all. There are other methods also to get Linux connect to Windows clients, but by far what we have outlined here are the simplest methods. And considering the number of graphical utilities that are available for this task, you needn't even bother with any command line parameters. We just had a basic look at sharing files using Samba, but there are many more alternatives such as the Andrew File System (AFS). Better interfaces are the order of the day, and the Windows-Linux network may soon seem an integrated whole.
Post a Comment

You might also like :

Related Posts with Thumbnails