Century's Samba FAQ for SCO OpenServer 5.05 ------------------------------------------- Note that all executables mentioned in this FAQ should be located in "/usr/local/samba/bin", unless otherwise stated. The configuration file, "smb.conf", is located in "/usr/local/samba/lib". Q: How do I add a new user to the Samba password file? A: Use the "smbpasswd" command as follows: smbpasswd -a Substitute the new username for "". Note that the "-a" option may only be used by root. You will only need to add new users that are created after Samba was installed. Q: How do I change my Samba password? A: The Samba password may be changed via the "smbpasswd" command, much the same as UNIX passwords. Note that, while Samba does support the synchronization of UNIX and Samba passwords, synchronization does not work reliably with the SCO "passwd" utility. Also note that for users other than root, changing Samba passwords with "smbpasswd" requires a properly configured guest account (see "Installing the Century Samba Distribution) as well as a running Samba daemon. Initially, passwords for non-root users must always be set by root. Q: How do I mount a Samba filesystem on my Windows machine? A: An entry for the individual filesystem or share must be placed in the "smb.conf" file. This file is usually located in "/usr/local/samba/lib/". This can be done for a share called "myshare" by adding the following lines: [myshare] path = /path_to_myshare This creates a share with a root directory "/path_to_myshare", for use by anyone with permissions on the SCO machine. After modifying the "smb.conf" file, check its validity with "testparm" (see "How can I find out if my smb.conf file is correct?"), and restart Samba. The new share should now be visible from all Windows machines in the same domain or workgroup. Note that the share name "homes" is reserved to allow users access to home directories (as specified by their UNIX accounts.) A "homes" share will automatically map to users' home directory, as seen from a Windows machine. Q: How do I create a Samba guest share? A: Any Samba share can be made a guest share by adding the following line to that share's section in the "smb.conf" file: guest ok = yes Note, the share's directory must have permissions set to allow the guest account access to the directory and its files. Anyone using the same username as the guest account on the SCO machine, can view the share. Q: How do I limit access to a Samba share? A: There are a number of ways to limit access to certain users, or to certain locations. Here is a list of some items which can be added to smb.conf: valid users Comma delimited list of usernames for determining which users will be allowed access to the share invalid users Comma delimited list of usernames for determining which users will be denied access to the share hosts allow Host names/addresses with wildcards for determining which locations will be allowed access to the share. For example, "pcbob" and "pcsam" may be allowed with the string "hosts allow = pcbob, pcsam". To allow access to 150.203.*.*, use "hosts allow = 150.203.". Also, the keyword "EXCEPT" may be used to create an exception to a wildcard address. For example, to allow access to 150.203.*.*, but deny 150.203.6.66, use "hosts allow = 150.203. EXCEPT 150.203.6.66". hosts deny Host names/addresses with wildcards for determining which locations will be denied access to the share. Syntax for "hosts deny" is the same as that for "hosts allow". read only Switch to restrict a share to read only. For example, "read only = yes" will make the share read only. read list Comma delimited list of usernames for determining which users have read only access to the share. write list Comma delimited list of usernames for determining which users have read/write access to the share. Use this option in conjunction with "read only = yes" to precisely control which users may write to a share. Samba provides many other optional settings. For details, see the smb.conf man page. Q: How do I use a printer attached to a remote SCO OpenServer machine on my Windows machine? A: You must configure SCO and then create a new printer on the Windows machine: 1. At the SCO prompt, start the printer manager by typing "scoadmin printer". 2. From the menu, select Printer and then Add Local. 3. For the printer's Model, select "PlainLocal" (a script provided by Century). Fill out the other fields for the local printer. 4. Make sure both local and remote print services are on (in SCOAdmin) by checking them in Print Services command on the System menu. 5. If necessary, create an "/etc/printcap" file. Add the following text to the "/etc/printcap" file: :\ :lp=:ex:sd=/usr/spool/lpd/: Substitute "" with the name you gave the printer, and "" with the device assigned to its port (possibly "lp0"). Note that the spool directory setting ("sd=...") is not used by Samba, which instead uses the path given in the "[printers]" share. 6. At the SCO prompt, make a spool directory for the printer by typing "mkdir /usr/spool/lpd/" (again substituting "" for the name you gave the printer.) You will also need to create a general Samba spool directory by typing something like "mkdir /usr/spool/smbspool" and then "chmod 777 /usr/spool/smbspool" to make it accessible to everyone. If you do not want to grant all users access to the Samba printer, you may instead create a group for everyone who is allowed to print and give the directory permission "775" (rwxrwxr-x). 7. Insert the following text into the global section of "smb.conf", if not already present: printcap name = /etc/printcap And add the printer share, if not already present: [printers] path = /usr/spool/smbspool writeable = no browseable = no printable = yes Note that if you did not name your Samba spool directory "/usr/spool/smbspool", you should replace the "path =" entry with your spool directory name. 8. Restart the Samba daemon. The printer should now be visible from Windows machines. 9. On the Windows machine, add the printer as a network print server. When prompted for a printer driver, select the driver appropriate to the printer on the SCO machine. The Windows machine should now be able to print to the remote printer. The queue for the printer may be viewed by double clicking on the printer's icon. Q: How do I use a printer attached to a remote Windows machine on my SCO OpenServer machine? A: First of all, you must make the printer available as an Samba printer share. Then perform the following steps: 1. Edit the "/usr/spool/lp/model/SambaRemote" file to set the following variables: PRNUSER= PRNPASS= PRNHOST= PRNNAME= Substitute a valid username and password for "" and "" (possibly a guest account or one created exclusively for printing). Substitute the Windows machine name for "" and the Windows printer name for "". 2. At the SCO prompt, start the printer manager by typing "scoadmin printer". 3. From the menu, select Printer then select Add Local. 4. For the printer's "Model", select "SambaRemote" (script provided by Century). Fill out the other fields as appropriate for the local printer, and exit SCOAdmin. 5. Add the following text to the "/etc/printcap" file: :\ :ex:sd=/usr/spool/lpd/: Substitute "" for the name you gave the printer. 6. At the SCO prompt, make a spool directory for the printer by typing "mkdir /usr/spool/lpd/" (again substituting "" for the name you gave the printer.) 7. If you would like this printer to be visible as a printer share on the SCO machine, see "How do I use a printer attached to a remote SCO OpenServer machine on my Windows machine?" beginning at step 5. Q: Why doesn't the printer I installed for my Windows machine (using the model script "PlainLocal") print properly using "lp" from my SCO machine? A: Because this printer was set up for windows, UNIX text files will only print properly with "lp" using the "-o text" option. (Additionally, "-o txt", "-o asc", and "-o ascii" all do the same thing as "-o text".) If this script is not being used to print by Windows machines, the default print "DATATYPE" in the model file may be changed to "text", at which time "-o bin", "-o binary", and "-o raw" may be used to print in binary mode. Q: Why doesn't the printer I installed for my SCO machine to print through Samba (using the model script "SambaRemote") work properly when trying to print through Windows? A: Because this printer was set up for printing text on UNIX, Windows text and graphic files will probably not print correctly. The script can be easily changed to print raw data by default through editing of the SambaRemote script, setting the "DATATYPE" to "binary". After this is done, text files may be printed from UNIX using "-o bin", "-o binary", and "-o raw". Q: How can I find out if my smb.conf file is correct? A: Run the Samba "testparm" program. This will determine whether the current "smb.conf" is syntactically correct, and will display all settings (including defaults). Q: How do I start/stop/restart Samba? A: If you have installed Samba to init.d / rc2.d, this is as simple as typing "/etc/init.d/smb start", "/etc/init.d/smb stop", or "/etc/init.d/smb restart". Samba is automatically started on boot to multi-user mode. If you have installed Samba to inetd, users should not attempt to manually start the daemons. The Samba daemon may be killed by sending SIGTERM to the appropriate pid (for smbd and nmbd), however the entries will have to be removed from inetd.conf to keep it from coming back. Restarting Samba is just a matter of stopping and restarting, as previously described. The inetd will automatically spawn a Samba daemon when it receives a smb request (although it will not announce it's presence to the network until this happens). If Samba is not installed to any startup mechanism, it must be started manually. This can be done most easily using the "startsmb" script provided by Century (in the "Century" subdirectory of the Samba distribution). Without the script, Samba may be started by typing the lines "/usr/local/samba/bin/smbd -D" and "/usr/local/samba/bin/nmbd -D". To stop Samba, send SIGTERM to the pids of smbd and nmbd. Note that Samba may be restarted by sending SIGHUP to the appropriate pid (or "/etc/init.d/smb reload" if you have installed to init.d / rc2.d.) Although this will cause it to re-read "smb.conf", it is preferable to actually stop and restart the daemon so that it properly will re-announce itself. Q: How do I get Samba to recognize changes I have made to "smb.conf" or "/etc/printcap"? A: Samba must be restarted before changes to "smb.conf" or "/etc/printcap" will take effect. See "How do I start/stop/restart Samba" for details. Q: Why does my Windows machine sometimes deny me access to my SCO machine after I restart Samba? A: Windows Samba seems to have occasional problems coping with a restart of Samba on a machine it is currently browsing or has recently browsed. The simplest solution to this is to reboot the Windows machine. If this does not help, see the text file "DIAGNOSIS.txt" in the Samba distribution's doc/textdocs directory.