![[GFARM LOGO]](../../pic/gfarm-logo.gif) documents >
User's Manual >
samba/hook
 
documents >
User's Manual >
samba/hook
  This document describes how to configure samba to access Gfarm
  file system from Windows clients, by invoking samba with preloaded
  Gfarm system-call-hooking library.
  
  Another solution:
  GfarmFS-FUSE + Samba
  You can access Gfarm file system using Samba via FUSE, but we 
  recommend using syscall-hooking library because it is easier
  to configure and use.
| kernel change notify = no | 
Add a section to access Gfarm file system.
Define the following parameters in the section.
Specify as following to make files unexecutable.
| create mask = 0644 | 
Specify following parameters to make Samba not invoke such system calls.
| oplocks = no level2 oplocks = no | 
We show you an example section to add for multiple users to share the whole Gfarm file system.
| [gfarm-public] comment = Gfarm Public Stuff path = /gfarm public = yes writable = yes printable = no create mask = 0644 oplocks = no level2 oplocks = no | 
We explain using a case on RedHat Linux here.
Add or change the following items for starting smbd. In case of RedHat Linux, starting smbd is described in the function start() in the script file '/etc/init.d/smb'.
Add the following lines just before invoking smbd:
| n=$(( $(gfhost -M | wc -l) + 50)) if [ -n "$m" -a X"$m" != X"unlimited" -a "$m" -lt $n ]; then ulimit -n $n fi | 
Add the setting of environment variables LD_PRELOAD and LD_LIBRARY_PATH to the beginning of the line which invokes smbd. Refer to the README.hook.en document for detail.
For example, in case of RedHat Linux, change the following line
| daemon smbd $SMBDOPTIONS | 
to
| gfarm_prefix=/usr globus_location=/usr/grid globus_flavor=gcc32 LD_LIBRARY_PATH="$globus_location/lib" LD_PRELOAD="$globus_location/lib/libglobus_gssapi_gsi_$globus_flavor.so.0 $globus_location/lib/libssl_$globus_flavor.so.0 $gfarm_prefix/lib/libgfs_hook.so.0 /usr/lib/gfarm/libpthread-not-hidden.so /usr/lib/gfarm/libc-not-hidden.so" daemon smbd $SMBDOPTIONS | 
Configure the variable gfarm_prefix and globus_location to match your installation pathnames of Gfarm and Globus, and configure globus_flavor variable to match your Globus flavor name which is linked with Gfarm.
Before adding these Globus related paths, you need to install Globus shared libraries if you have linked Globus libraries to Gfarm binaries, otherwise you need not this addition. If you install Gfarm binary distribution for RedHat Linux, you need this addition because they are linked with Globus.
Adding assignment to LD_LIBRALY_PATH is necessary only if Globus is dynamically linked to Gfarm binaries. Binary distribution for RedHat Linux is statically linked with Globus so it can be omitted.
Specifying "*-not-hiddden.so" is unnecessary on OS other than Linux.
| 
#!/bin/sh
(*snip*)
start() {
	KIND="SMB"
	echo -n $"Starting $KIND services: "
	m=`ulimit -n`
	n=$(( $(gfhost -M | wc -l) + 50))
	if [ -n "$m" -a X"$m" != X"unlimited" -a "$m" -lt $n ]; then
		ulimit -n $n
	fi
	gfarm_prefix=/usr
	globus_location=/usr/grid
	globus_flavor=gcc32
	LD_LIBRARY_PATH="$globus_location/lib" LD_PRELOAD="$globus_location/lib/libglobus_gssapi_gsi_$globus_flavor.so.0 $globus_location/lib/libssl_$globus_flavor.so.0 $gfarm_prefix/lib/libgfs_hook.so.0 /usr/lib/gfarm/libpthread-not-hidden.so /usr/lib/gfarm/libc-not-hidden.so" daemon smbd $SMBOPTIONS
	RETVAL=$?
	echo
	KIND="NMB"
	echo -n $"Starting $KIND services: "
	daemon nmbd $NMBDOPTIONS
	RETVAL2=$?
	echo
	[ $RETVAL -eq 0 -a $RETVAL2 -eq 0 ] && touch /var/lock/subsys/smb || \
	   RETVAL=1
	return $RETVAL
}	
(*snip*) | 
For example, invoke the following command on RedHat Linux.
| # /etc/init.d/smb [start|restart] | 
Map a network drive to the Samba share. The following sample steps shows how to map