Samba is an elaborate client-server system that allows Unix and PC installations to share resources such as filesystems and printers. It attempts to seamlessly integrate what would otherwise be quite separate Unix and Windows local networks. Setting up a Samba server on one of our Linux machines would allow, for instance, students working on a PC in a laboratory or dorm room to go to their PC's network neighborhood, and effectively mount their Linux home directories on their PC and share files back and forth.
VNC goes a step farther than Samba. Under VNC you can actually see your PC's desktop on your Linux monitor and manipulate it from there, but we will save that story for another day.
Samba documentation
To get off to a good start, go to the Samba web pages for the official word on how to install Samba, as well as a great deal of Samba documentation including an online version of the O'Reilly Samba book (with an impressive African ground hornbill on the cover). The notes on the present page offer something of a Fast Track version of the official instructions.
Modify /etc/samba/smb.conf
First, modify /etc/samba/smb.conf as follows:
Add under the heading [global] workgroup = Linuxlab Add under the heading [homes] path = /home/%U
Now run testparms to check your config file.
[root@pluto samba]# testparm /etc/samba/smb.conf Load smb config files from /etc/samba/smb.conf Processing section "[homes]" Processing section "[printers]" Loaded services file OK. Press enter to see a dump of your service definitions
Start the samba daemons
Start the samba daemons from the command line.
[root@pluto init.d]# /etc/rc.d/init.d/smb start Starting SMB services: [ OK ] Starting NMB services: [ OK ]
To arrange for Samba to start automatically on rebooting, launch ksysv, locate the smb icon in the righthand column under the name Available Services, and drag it VERY CAREFULLY into the Runlevel5 Start column and slot it in just under the entry for 15 nfs. You should see a new blue entry 16 smb. Similarly, drag the smb icon from the Available Services column into the Runlevel 3 Start column and slot it in just under 15 nfs. You should see a new blue entry for 16 smb. VERY CAREFULLY, select File:Save Configuration, and exit from ksysv. If your karma is 100% up to snuff, the smbd and nmbd daemons will start up automatically after each machine reboot.
Testing the installation
Try listing the shares (= shared resources in Samba-speak) available on your host by issuing the command smbclient -L
[root@pluto notes]# smbclient -L pluto added interface ip=152.97.2.210 bcast=152.97.255.255 nmask=255.255.0.0 Password: Anonymous login successful Domain=[LINUXLAB] OS=[Unix] Server=[Samba 2.2.1a] Sharename Type Comment --------- ---- ------- IPC$ IPC IPC Service (Samba Server) ADMIN$ Disk IPC Service (Samba Server) lpcs3 Printer WL131_LaserJet_2100 lpcs1 Printer WL136_LaserJet_2100 lpcs2 Printer WL133_LaserJet_4000N Server Comment --------- ------- CRESSIDA cressida server (Samba 2.0.10) PLUTO Samba Server Workgroup Master --------- ------- LINUXLAB CRESSIDA
Add yourself as a Samba user by typing smbpasswd -a <login> <password> where (you guessed it) <login> is your login on the linux machine and <password> is your Samba password. Thus,
smbpasswd -a parrish snagglegrumph
adds user parrish to the smbpasswd file and sets the password for parrish. You can change your Samba password with the command
smbpasswd parrish
And now for the biggest test of all. Go find a PC, click on Network Neighborhood, and keep clicking until you get down to the Linuxlab collection of "shares" (shared computers). You should see an icon there for your new Samba-ready computer. Click on it to display a login screen. Enter your login and Samba password, and -- Bingo! You should be looking at the contents of your home directory on your linux computer. Try sending a few files back and forth between the PC and the Linux box. Congratulations! This functionality provides a very smooth connection between our local linux and PC networks.