Linux Know-How provides a collection of introductory texts on often needed Linux skills.


How to use Samba?

Samba (smb) is for Linux-MS Windows networking. It is a program that makes a Linux computer pretend to be a MS Windows NT server, and thus lets your MS Windows 3.1/95/98-based computers connect to the network. Samba not only replaces WinNT--it is acclaimed to do a much better job than WinNT!

One of the three machines on my home network is a dual Linux/Win95 boot. I configured my network so that if I boot Win95, another Linux machine acts as a Samba server. This way, the Win95 machine has access to the network printer, shared directories on Linux, can telnet, browse the Internet through a modem on Linux, etc. I can also access the files on the remote Win95 machine from Linux computers.

It is necessary to configure Samba only on one Linux machine.

First, I ran setup as root, choose "System Services" (RH6.0) or "ntsysv" (RH5.2) from the menu, and make sure that the "smb" service is enabled. (The program setup has help if you press <F1>. Just in case you were curious what the different services are for.) If smb is not listed there, maybe you did not install it during your RedHat setup? You may want to put your RedHat CD into the CDROM, mount the CD, start glint (RH5.2) or gnorpm (RH6.0) installation utility (as root) and add Samba to your system.

The second part is to configure Samba. This is relatively simple since the Samba configuration is done through a single, well commented file: /etc/smb.config . The minimum setup includes specifying the workgroup name. Note that if you don't fill up the "host allow" option, all hosts are allowed, which is probably OK for the home network. The other options in the example /etc/smb.conf supplied with your RedHat CD may require adjustment to suit your particular needs, but they didn't have to be changed to get a Windows machine connected to my Samba server.

Check that the options

domain master = yes

domain logons = yes

are enabled in /etc/smb.conf. You probably want them.

Under RH6.0, you may also perform a basic samba setup using (as root):

netconf

The third step is to configure your MS Windows 95 (or whatever) for networking. This is done exactly as if you were connecting to a WinNT server. Make sure to enable the networking ("client for Microsoft Network") and fill up the workgroup name. To login on the network when booting MS Windows, use your Linux user ID and password. To see if it worked, click on the icon "Network Neighborhood"--your Linux server should be listed there, and underneath you should see the shared directories and printers that you chose to share in the file /etc/smb.conf.

If you can't see or use the public directories, make sure that you created them and set the proper read/write permissions for all users.

MS Windows 95b and above (95c, 98, and newer NTs) may use password encryption. This will make your logins from the Window's machine fail, and you may need to enable this option in the /etc/smb.conf file:

encrypt passwords = yes

On the Linux server, you can start, stop, restart and check the Samba status using these commands (as root):

samba start

samba status

samba restart

samba stop

You need to re-start samba after making changes to your /etc/smb.conf file.

You can browse the net using your Netscape for Windows if you are connected to your Linux computer through Samba and the Linux machine is currently connected to the Internet. To do this, the IP masquerading must be set up on the Linux machine with the modem (described here) and you must enable the Samba dns name resolution in /etc/smb.conf :

dns proxy = yes

and then tell Windows to enable the dns server, specify the Linux server name and IP address (in ControlPanel-Network-TCP/IP).

You can also mount a remote Windows directory onto your Linux file system. Look here to see how.

The above described just a minimal Samba setup. You can get more information from:

man samba

man smb.conf

man smbclient

man smbmount

less /usr/doc/HOWTO/SMB-HOWTO (under RH5.2)

documentation in /usr/doc/samba-2.0.3/doc (under RH6.0)

http://www.sfu.ca/~yzhang/linux/samba/ (samba minihowto)

http://www.germanynet.de/teilnehmer/101,69082/samba.html

and also by studying the file /etc/smb.conf .


Last Update: 2010-12-16