Hi, here is a detailed description on how i have setup Samba, as as SMF service, it covers the SMF setup and the Swat configuration. I converted it from a word document, so the formatting is not verry nice, sorry.
Samba
We use the samba from sun (SFW) its configuration files are in /etc/sfw
Samba Setup
First we remove the old startup scripts:
# ls -l /etc/rc?.d/???samba
-rwxr--r-- 6 root sys 324 Jan 14 2006 /etc/rc0.d/K03samba
-rwxr--r-- 6 root sys 324 Jan 14 2006 /etc/rc1.d/K03samba
-rwxr--r-- 6 root sys 324 Jan 14 2006 /etc/rc2.d/K03samba
-rwxr--r-- 6 root sys 324 Jan 14 2006 /etc/rc3.d/S90samba
-rwxr--r-- 6 root sys 324 Jan 14 2006 /etc/rcS.d/K03samba
# rm /etc/rc?.d/???samba
# mv /etc/init.d/samba /etc/init.d/nonsmf_samba
Then we need a configuration:
# cd /etc/sfw
# cp swamba.conf-exampel samba.conf
Create a control script /opt/local/lib/svc/method/samba which contains
#!/sbin/sh
#
case "$1" in
start)
/usr/sfw/sbin/smbd -D
/usr/sfw/sbin/nmbd -D
;;
stop)
pkill smbd
pkill nmbd
;;
*)
echo "Usage: $0 { start | stop }"
exit 1
;;
esac
exit 0
The manifest in /root/samba/samba.xml should contain
<?xml version='1.0'?>
<!DOCTYPE service_bundle SYSTEM '/usr/share/lib/xml/dtd/service_bundle.dtd.1'>
<service_bundle type='manifest' name='WISWsamba:samba'>
<service name='site/samba' type='service' version='0'>
<create_default_instance enabled="false"/>
<single_instance/>
<!--
First of all, if the config file is not present,
then we needn't bother with anything else.
-->
<dependency name="config-file" grouping="require_all" restart_on="none" type="path">
<service_fmri value="file:///etc/sfw/smb.conf"/>
</dependency>
<!--
If there's no network, then there's no point in running
-->
<dependency name='loopback' grouping='require_all' restart_on='error' type='service'>
<service_fmri value='svc:/network/loopback:default'/>
</dependency>
<dependency name='physical' grouping='optional_all' restart_on='error' type='service'>
<service_fmri value='svc:/network/physical:default'/>
</dependency>
<!--
Since Samba may be providing a home directory service,
it is as well that we ensure that the file-systems are
all mounted before it is started. This is not essential
but in general it is a good thing and doesn't really hurt.
-->
<dependency name='fs-local' grouping='require_all' restart_on='none' type='service'>
<service_fmri value='svc:/system/filesystem/local'/>
</dependency>
<!--
now we have the start stop and refresh methods
-->
<exec_method name='start' type='method' exec='/opt/local/lib/svc/method/samba start' timeout_seconds='60'>
<method_context/>
</exec_method>
<exec_method name='stop' type='method' exec='/opt/local/lib/svc/method/samba stop' timeout_seconds='60'>
<method_context/>
</exec_method>
<property_group name='samba' type='application'>
<stability value='Evolving'/>
</property_group>
<property_group name='startd' type='framework'>
<propval name='ignore_error' type='astring' value='core,signal'/>
</property_group>
<stability value='Evolving'/>
<!--
A description of the Service
-->
<template>
<common_name>
<loctext xml:lang='C'>Samba Server</loctext>
</common_name>
<documentation>
<manpage title='samba' section='1M'/>
<doc_link name='samba.org' uri='http://httpd.samba.org'/>
</documentation>
</template>
</service>
</service_bundle>
Import the manifes
# svccfg import /root/samba/samba.xml
Start Samba
# svcadm enable samba
SWAT Setup
First, add an entry in /etc/services for swat:-
swat 901/tcp # Samba Web Administration Tool
now, create a file containing a valid inted.conf-style entry for swat, for example /inet.swat:
# echo swat stream tcp nowait root /usr/sfw/sbin/swat swat>>inet-swat
Now run inetconv as follows:-
# inetconv -i inet-swat
swat -> /var/svc/manifest/network/swat-tcp.xml
Importing swat-tcp.xml ...Done
Now swat can be enabled (Note the service name):-
# inetadm -e svc:/network/swat/tcp:default
List the service as follows:-
# inetadm -l svc:/network/swat/tcp:default
SCOPE NAME=VALUE
name="swat"
endpoint_type="stream"
proto="tcp"
isrpc=FALSE
wait=FALSE
exec="/usr/sfw/sbin/swat"
user="root"
default bind_addr=""
default bind_fail_max=-1
default bind_fail_interval=-1
default max_con_rate=-1
default max_copies=-1
default con_rate_offline=-1
default failrate_cnt=40
default failrate_interval=60
default inherit_env=TRUE
default tcp_trace=FALSE
default tcp_wrappers=FALSE
Now we can connect to SWAT with the url:
http://<hostname>:901/
Message was edited by:
Tom_Tiger