SAMBA is an open source software suite that provides seamless file and print services to SMB/CIFS clients. It is available for Linux, Solaris, SunOS, HP-UX, ULTRIX, DEC OSF/1, Digital UNIX, Dynix (Sequent), IRIX (SGI), SCO Open Server, DG-UX, UNIXWARE, AIX, BSDI, NetBSD, NEXTSTEP, A/UX, etc. For a detailed introduction see this article. Linux machines using SAMBA are seen by NT as part of a NT Domain and can share printers and directories with Windows (95/98/NT) machines. This tutorial will cover the basics of installing and setting up SAMBA, and also TkSmb, a graphical tool to manage shares between Linux and NT.
The RedHat distribution includes a rpm file for SAMBA version 2.0. Mount the CD-ROM 1 (or use the copy you downloaded), locate and install the package samba-2.0*.rpm . SAMBA will be installed in /usr/sbin as smbd (the SMB/CIFS server) and nmbd (the samba NETBIOS name server). A series of client programs are installed: smbclient, smbprint, smbtar, smbwrapper, etc. A Samba Web Administration tool is also installed in /usr/sbin as swat. Finally, three other files smbmount, smbumount and smbmnt are also placed in /usr/sbin to implement the smbfs (SAMBA File System).
Start by checking your /etc/hosts file and be sure that all machines in your LAN have an entry there, just to be in the safe side. Then add the following lines to the /etc/inetd.conf file, and save it:
It is now time to make changes so that your Linux machine may join a NT Domain. Open Netscape and go to the location http://localhost:901/ and the SWAT Web Admin tool will let you continue the configuration, after you log as root with the root password. Select GLOBALS to start editting smb.conf in the browser.
In Base Options: enter your NT domain name in workgroup. Enter the name of your machine (not the FQDN) as you used in host name in netbios name, and a simple description in server string (like Linux machine), and skip interfaces for now.
In Security Options: select DOMAIN in security, Yes in encrypt password, then enter the name of the NT PDC machine NETBIOS name in password server (if you do not see an entry for password server, scroll up, select Advanced View, look for the password server entry and do enter the name, then select back Basic View). Finally in hosts allow enter the IP numbers of the PDC machine, of your Linux machine and 127, all followed by a period and separated by a space (e.g. 192.168.0.7. 192.168.0.12. 127.). You can leave all other options as they are (default).
Scroll up and select Commit Changes. You can close the SWAT window. The procedure continues now in the NT PDC machine. Go to Start,Program, Administrative Tools and select Server Manager. Add the Linux machine to the Domain as shown in this example. Close server manager and reboot your Linux machine to make all your changes effective and seen by NT. After you reboot, type the following at the command prompt:
Where DOMAIN is the name of the NT domain your Linux machine is joining, and PDCNAME is the NT PDC machine NETBIOS name. If all went well (a miracle) you will see the message smbpasswd: Joined domain DOMAIN. If you had problems (not joined the domain) read a more detailed tutorial and try again. You may also need to use Server Manager in NT to fix the problem. Once you joined the domain start SAMBA: /etc/rc.d/init.d/smb start and you are ready to share printers and files.
You can use a Windows shared printer in Linux using SAMBA. Red Hat has a Printer Tool to help you do this the easy way. Log in as root and start X. Open a shell window and type printtool and a graphical window -- RedHat Linux Print System Manager -- will open. Click on Add and in the Add Printer dialog choose SMB/Windows 95/NT Printer and click on OK. A new dialog will open and you will be able to enter the name of the Windows machine sharing the printer, the printer name, your user name and password in the Windows machine, and the NT Domain or Windows Workgroup name. Before you press OK, click on Select in order to select your printer from the Configure Filter dialog. After you select your printer press OK twice to return to the main Print Tool dialog. Click on your new printer, select Tests and select Print ASCII test page to test the setup of your new printer.
smbmount, smbumount and smbmnt allow you to mount and unmount a Windows share in Linux. For example: smbmount //ws101/c -c 'mount /mnt/smb -u 123 -g 456' mounts //ws101/c on /mnt/smb. The explanation of the full use of SAMBA is beyond the scope of this tutorial. I suggest you read the SAMBA documentation and/or buy a book on the subject.
TkSmb lets you browse graphically shares in a Windows LAN from a Linux machine. You can select the machine you want to access the shared directories, select a directory and then copy files from that directory to a Linux directory of your choice. This image shows the user abento connected to the host R400, with the available shared directories of R400. If a directory is selected from R400 (in the example), then a list of the files and directories is displayed in a lower pane of the TkSmb tool.
Download TkSmb from its home page. You will get the file TkSmb-0_8_6_tar.gz, or a latest version of it. Again save it in the downloads directory. Proceed to uncompress and install TkSmb as follows:
Finally, copy the file TkSmb to the /home/user/bin directory and create a link to the desktop.