!http://www.sun.com/bigadmin/home/images/bigadminHeaderWikiThumb.jpg!
{section:border=false}
{column:width=20%}
{include:TOC for Tech Tips}
{column}
{column:width=55%}
The default samba service provided with Solaris 10 08/07 provides access to the smb daemon only.
If you wish the shares provided by the machine to be browsable the {{nmbd(1m)}} daemon needs to be running.
This can be added as a separate service. But instead we'll change the existing samba service to provide both daemons as separate instances of the samba service.
To obtain the current manifest you should export it from the repository.
_Note, the default manifest is distributed as /var/svc/manifest/network/samba.xml and could be used as the starting point._
{noformat}
# svccfg export samba > samba.xml
{noformat}
This gives us the working document we will edit.
The changes we will make are:
* Because we will not have the default instance after our changes, and because we'll be using two instances, one for smb and one for nmb we delete the lines for {{create_default_instance}} and {{single_instance}}.
* We need to wrap the existing start and stop methods into an instance.
* We have to add an instance for the nmbd daemon with its own start and stop methods.
* We have to change the documentation links to refer to the nmbd daemon's manpage.
Other changes we can make include:
* Adding a dependancy on the configuration file, as the default exit value of {{255}} from the daemons does not match the smf {{SMF_EXIT_ERR_CONFIG}} code of {{96}}.
* Changing the kill method to {{:kill}} so that ALL the daemons die when the service is disabled. This affects existing sessions as well as just new sessions.
h4.The modified samba.xml
{code:xml|title=samba.xml}
<?xml version='1.0'?>
<!DOCTYPE service_bundle SYSTEM '/usr/share/lib/xml/dtd/service_bundle.dtd.1'>
<service_bundle type='manifest' name='export'>
<service name='network/samba' type='service' version='0'>
<!-- Remove the create_default_instance and single_instance lines -->
<dependency name='net-loopback' grouping='require_any' restart_on='none' type='service'>
<service_fmri value='svc:/network/loopback'/>
</dependency>
<dependency name='net-service' grouping='require_all' restart_on='none' type='service'>
<service_fmri value='svc:/network/service'/>
</dependency>
<dependency name='net-physical' grouping='require_all' restart_on='none' type='service'>
<service_fmri value='svc:/network/physical'/>
</dependency>
<dependency name='filesystem-local' grouping='require_all' restart_on='none' type='service'>
<service_fmri value='svc:/system/filesystem/local'/>
</dependency>
<!-- Add a dependancy for the config file -->
<dependency name='config_data' grouping='require_all' restart_on='none' type='path'>
<service_fmri value='file://localhost/etc/sfw/smb.conf'/>
</dependency>
<dependent name='samba_multi-user-server' restart_on='none' grouping='optional_all'>
<service_fmri value='svc:/milestone/multi-user-server'/>
</dependent>
<!--
Move the smbd daemon startup methods into an instance.
We'll call this instance smbd
-->
<instance name='smbd' enabled='false'>
<exec_method name='start' type='method' exec='/usr/sfw/sbin/smbd -D' timeout_seconds='170'>
<method_context/>
</exec_method>
<!-- change the stop method to kill all the daemons,
including existing sessions -->
<exec_method name='stop' type='method' exec=':kill' timeout_seconds='60'>
<method_context/>
</exec_method>
</instance>
<!-- Add the nmbd instance -->
<instance name='nmbd' enabled='false'>
<exec_method name='start' type='method' exec='/usr/sfw/sbin/nmbd -D' timeout_seconds='170'>
<method_context/>
</exec_method>
<exec_method name='stop' type='method' exec=':kill' timeout_seconds='60'>
<method_context/>
</exec_method>
</instance>
<stability value='Unstable'/>
<template>
<common_name>
<loctext xml:lang='C'>SMB file server</loctext>
</common_name>
<documentation>
<manpage title='smbd' section='1m' manpath='/usr/sfw/man'/>
<manpage title='nmbd' section='1m' manpath='/usr/sfw/man'/>
<manpage title='smb.conf' section='4' manpath='/usr/sfw/man'/>
</documentation>
</template>
</service>
</service_bundle>
{code}
h4.Enabling The Modifications
{noformat}
# svcadm disable samba
# svccfg import samba.xml
# svccfg delete svc:/network/samba:default
# svcadm refresh samba:smbd
# svcadm refresh samba:nmbd
# svcadm enable samba:smbd
# svcadm enable samba:nmbd
{noformat}
h4.Checking The Result
The {{svcs}} command can be used to verify the services are now running, and the {{nmblookup}} command can be used to verify the machine is part of the browse group.
{noformat}
# svcs samba
STATE STIME FMRI
online 8:34:16 svc:/network/samba:smbd
online 8:35:00 svc:/network/samba:nmbd
# svcs -p samba
STATE STIME FMRI
online 8:34:16 svc:/network/samba:smbd
8:34:16 2038 smbd
8:34:16 2039 smbd
online 8:35:00 svc:/network/samba:nmbd
8:35:00 2066 nmbd
# /usr/sfw/bin/nmblookup SMBGROUP
querying SMBGROUP on 192.168.1.255
192.168.1.138 SMBGROUP<00>
192.168.1.134 SMBGROUP<00>
192.168.1.2 SMBGROUP<00>
192.168.1.76 SMBGROUP<00>
192.168.1.1 SMBGROUP<00>
192.168.1.51 SMBGROUP<00>
{noformat}
{column}
{section}
{section:border=false}
{column:width=20%}
{include:TOC for Tech Tips}
{column}
{column:width=55%}
The default samba service provided with Solaris 10 08/07 provides access to the smb daemon only.
If you wish the shares provided by the machine to be browsable the {{nmbd(1m)}} daemon needs to be running.
This can be added as a separate service. But instead we'll change the existing samba service to provide both daemons as separate instances of the samba service.
To obtain the current manifest you should export it from the repository.
_Note, the default manifest is distributed as /var/svc/manifest/network/samba.xml and could be used as the starting point._
{noformat}
# svccfg export samba > samba.xml
{noformat}
This gives us the working document we will edit.
The changes we will make are:
* Because we will not have the default instance after our changes, and because we'll be using two instances, one for smb and one for nmb we delete the lines for {{create_default_instance}} and {{single_instance}}.
* We need to wrap the existing start and stop methods into an instance.
* We have to add an instance for the nmbd daemon with its own start and stop methods.
* We have to change the documentation links to refer to the nmbd daemon's manpage.
Other changes we can make include:
* Adding a dependancy on the configuration file, as the default exit value of {{255}} from the daemons does not match the smf {{SMF_EXIT_ERR_CONFIG}} code of {{96}}.
* Changing the kill method to {{:kill}} so that ALL the daemons die when the service is disabled. This affects existing sessions as well as just new sessions.
h4.The modified samba.xml
{code:xml|title=samba.xml}
<?xml version='1.0'?>
<!DOCTYPE service_bundle SYSTEM '/usr/share/lib/xml/dtd/service_bundle.dtd.1'>
<service_bundle type='manifest' name='export'>
<service name='network/samba' type='service' version='0'>
<!-- Remove the create_default_instance and single_instance lines -->
<dependency name='net-loopback' grouping='require_any' restart_on='none' type='service'>
<service_fmri value='svc:/network/loopback'/>
</dependency>
<dependency name='net-service' grouping='require_all' restart_on='none' type='service'>
<service_fmri value='svc:/network/service'/>
</dependency>
<dependency name='net-physical' grouping='require_all' restart_on='none' type='service'>
<service_fmri value='svc:/network/physical'/>
</dependency>
<dependency name='filesystem-local' grouping='require_all' restart_on='none' type='service'>
<service_fmri value='svc:/system/filesystem/local'/>
</dependency>
<!-- Add a dependancy for the config file -->
<dependency name='config_data' grouping='require_all' restart_on='none' type='path'>
<service_fmri value='file://localhost/etc/sfw/smb.conf'/>
</dependency>
<dependent name='samba_multi-user-server' restart_on='none' grouping='optional_all'>
<service_fmri value='svc:/milestone/multi-user-server'/>
</dependent>
<!--
Move the smbd daemon startup methods into an instance.
We'll call this instance smbd
-->
<instance name='smbd' enabled='false'>
<exec_method name='start' type='method' exec='/usr/sfw/sbin/smbd -D' timeout_seconds='170'>
<method_context/>
</exec_method>
<!-- change the stop method to kill all the daemons,
including existing sessions -->
<exec_method name='stop' type='method' exec=':kill' timeout_seconds='60'>
<method_context/>
</exec_method>
</instance>
<!-- Add the nmbd instance -->
<instance name='nmbd' enabled='false'>
<exec_method name='start' type='method' exec='/usr/sfw/sbin/nmbd -D' timeout_seconds='170'>
<method_context/>
</exec_method>
<exec_method name='stop' type='method' exec=':kill' timeout_seconds='60'>
<method_context/>
</exec_method>
</instance>
<stability value='Unstable'/>
<template>
<common_name>
<loctext xml:lang='C'>SMB file server</loctext>
</common_name>
<documentation>
<manpage title='smbd' section='1m' manpath='/usr/sfw/man'/>
<manpage title='nmbd' section='1m' manpath='/usr/sfw/man'/>
<manpage title='smb.conf' section='4' manpath='/usr/sfw/man'/>
</documentation>
</template>
</service>
</service_bundle>
{code}
h4.Enabling The Modifications
{noformat}
# svcadm disable samba
# svccfg import samba.xml
# svccfg delete svc:/network/samba:default
# svcadm refresh samba:smbd
# svcadm refresh samba:nmbd
# svcadm enable samba:smbd
# svcadm enable samba:nmbd
{noformat}
h4.Checking The Result
The {{svcs}} command can be used to verify the services are now running, and the {{nmblookup}} command can be used to verify the machine is part of the browse group.
{noformat}
# svcs samba
STATE STIME FMRI
online 8:34:16 svc:/network/samba:smbd
online 8:35:00 svc:/network/samba:nmbd
# svcs -p samba
STATE STIME FMRI
online 8:34:16 svc:/network/samba:smbd
8:34:16 2038 smbd
8:34:16 2039 smbd
online 8:35:00 svc:/network/samba:nmbd
8:35:00 2066 nmbd
# /usr/sfw/bin/nmblookup SMBGROUP
querying SMBGROUP on 192.168.1.255
192.168.1.138 SMBGROUP<00>
192.168.1.134 SMBGROUP<00>
192.168.1.2 SMBGROUP<00>
192.168.1.76 SMBGROUP<00>
192.168.1.1 SMBGROUP<00>
192.168.1.51 SMBGROUP<00>
{noformat}
{column}
{section}