ProTIPS Misc
Setting up CIFS/Samba on HP-Unix
 
This page documents how I set up the CIFS or SMB protocols using Samba on a HP-UX server running 10.20.

HP's product CIFS9000 ( http://www.hp.com/products1/unix/operating/hpuxcifs9000/index.html ) is available for HP-UX 11.00 onwards.

For HP-UX 10.20 I downloaded Samba from the HP Unix Porting Archive ( http://hpux.connect.org.uk/ ). After renaming the file to restore the ".gz" extension, and then using gunzip to unzip the ".depot" file, I was able to install in the usual way "swinstall -s ...".

I then referred to the Samba-HOWTO-Collection.html which is included in the "swat/help" folder of the HP-UX install, but also on the web at http://samba.mirror.ac.uk/samba/docs/man/Samba-HOWTO-Collection.html . I also referred to the O'Reilly ( http://www.oreilly.com/ ) "Using Samba" documentation which was also included in the "swat/using_samba" folder of the HP-UX install.

As the binaries were already compiled I was able to go straight to the step where you create the smb.conf configuration file.

According to the man page for smbd the "smb.conf" file should be located at "<samba_loadpoint>/lib/smb.conf". I found it located at "/etc/opt/samba/smb.conf".

Starting from the example smb.conf file, I added the line " encrypt passwords = yes " as described in "Using Samba":

If you are using Windows 98 or Windows NT Service Pack 3 or above, you must add the following entry to the [global] section of the Samba configuration file: encrypt passwords = yes. In addition, you must use the smbpassword program (typically located in /usr/local/samba/bin/) to reenter the username/password combinations of those users on the Unix server who should be able to access shares into Samba's encrypted client database. For example, if you wanted to allow Unix user steve to access shares from an SMB client, you could type: smbpassword -a steve. The first time a user is added, the program will output an error saying that the encrypted password database does not exist. Don't worry, it will then create the database for you. Make sure that the username/password combinations that you add to the encrypted database match the usernames and passwords that you intend to use on the Windows client side. It was then necessary to add each user to the database using the smbpassword command as described in "Using Samba".

Starting up the smbd and nmbd daemons manually, the "Simple" workgroup appeared in Windows NT as a domain next to our existing domain, so I changed the workgroup to the same as our existing domain and then the server appeared in the local network neighbourhood.

To configure Samba to start up and shut down automatically with the server, I created a script called startsmb which I put in a folder called startup in the samba loadpoint. The script is as follows:
 
#!/sbin/sh

mode=$1

case $mode in

'start_msg')
echo "Start Samba Server"
;;
'stop_msg')
echo "Stop Samba Server"
;;
'start')
/opt/samba/bin/smbd -D
/opt/samba/bin/nmbd -D
;;
'stop')
kill `cat /var/opt/samba/locks/smbd.pid`
kill `cat /var/opt/samba/locks/nmbd.pid`
rm -f /var/opt/samba/locks/smbd.pid
rm -f /var/opt/samba/locks/nmbd.pid
;;
*)
echo "Usage $0 { start | stop }"
esac
exit 0

I set the script to have execute permissions and tested this script by issuing the commands "./startsmb -start" and "./startsmb -stop".

I then copied this to /sbin/rc2.d as S999startsmb, using the following command:

cp -p startsmb /sbin/rc2.d/S999startsmb
This will make Samba shutdown and startup correctly, with the server.
 

Simon Toon, November 9th 2002 - January 14th 2006