{"id":5098,"date":"2015-08-13T14:07:53","date_gmt":"2015-08-13T06:07:53","guid":{"rendered":"http:\/\/rmohan.com\/?p=5098"},"modified":"2015-08-13T14:07:53","modified_gmt":"2015-08-13T06:07:53","slug":"adding-samba-to-the-service-management-facility","status":"publish","type":"post","link":"https:\/\/mohan.sg\/?p=5098","title":{"rendered":"Adding Samba to the Service Management Facility"},"content":{"rendered":"<p>I am a bit new to the Service Management Facility (SMF) introduced into Solaris 10, but after getting my feet wet I kinda like it. These steps came in handy for me when I needed to add Samba to SMF.<\/p>\n<p><strong>Backup and Remove samba rc* scripts<\/strong><br \/>\n<code><br \/>\nbash-3.00# tar cvpf - \/etc\/rc?.d\/???samba | gzip -c &gt; \/var\/tmp\/etc-rc-samba.tar.gz<br \/>\na \/etc\/rc0.d\/K03samba 1K<br \/>\na \/etc\/rc1.d\/K03samba link to \/etc\/rc0.d\/K03samba<br \/>\na \/etc\/rc2.d\/K03samba link to \/etc\/rc0.d\/K03samba<br \/>\na \/etc\/rc3.d\/S90samba link to \/etc\/rc0.d\/K03samba<br \/>\na \/etc\/rcS.d\/K03samba link to \/etc\/rc0.d\/K03samba<br \/>\n<\/code><\/p>\n<p><strong>Verify the archive:<\/strong><br \/>\n<code><br \/>\nbash-3.00# gunzip &lt; \/var\/tmp\/etc-rc-samba.tar.gz | tar -tvpf -<\/code><\/p>\n<p>Wait!! Let\u2019s hold off on removing the samba rc* files until everything is working properly.<\/p>\n<p>The following version and components of samba were installed at the time of this writing:<br \/>\n<code><br \/>\nbash-3.00# pkginfo -l | grep samba<br \/>\nNAME: samba - A Windows SMB\/CIFS fileserver for UNIX (client)<br \/>\nDESC: samba - A Windows SMB\/CIFS fileserver for UNIX (client) 3.0.11<br \/>\nNAME: samba - A Windows SMB\/CIFS fileserver for UNIX (Root)<br \/>\nDESC: samba - A Windows SMB\/CIFS fileserver for UNIX (Root) 3.0.11<br \/>\nNAME: samba - A Windows SMB\/CIFS fileserver for UNIX (Usr)<br \/>\nDESC: samba - A Windows SMB\/CIFS fileserver for UNIX (Usr) 3.0.11<br \/>\n<\/code><\/p>\n<p><strong>Create and edit the<span class=\"Apple-converted-space\">\u00a0<\/span><span class=\"skimlinks-unlinked\">smb.conf<\/span><span class=\"Apple-converted-space\">\u00a0<\/span>file<\/strong><br \/>\nIn the<span class=\"Apple-converted-space\">\u00a0<\/span><strong>\/etc\/sfw<\/strong><span class=\"Apple-converted-space\">\u00a0<\/span>directory copy the example<span class=\"Apple-converted-space\">\u00a0<\/span><em><span class=\"skimlinks-unlinked\">smb.conf-example<\/span><span class=\"Apple-converted-space\">\u00a0<\/span><\/em>file to<span class=\"Apple-converted-space\">\u00a0<\/span><span class=\"skimlinks-unlinked\">smb.conf<\/span><span class=\"Apple-converted-space\">\u00a0<\/span>and edite to your liking. I like to copy the sample file to<span class=\"Apple-converted-space\">\u00a0<\/span><em>smb-&lt;<strong>server_name<\/strong>&gt;.conf<\/em>.<\/p>\n<p><code>bash-3.00# pwd<br \/>\n\/etc\/sfw<br \/>\nbash-3.00# ls -l<br \/>\ntotal 66<br \/>\n...edited...<br \/>\n-rw-r--r-- 1 root bin 9975 Feb 12 11:01 smb.conf-example<\/code><\/p>\n<p>bash-3.00# cp<span class=\"Apple-converted-space\">\u00a0<\/span><span class=\"skimlinks-unlinked\">smb.conf-example<\/span><span class=\"Apple-converted-space\">\u00a0<\/span>smb-<strong>&lt;server_name&gt;<\/strong>.conf<br \/>\nbash-3.00# vi !$<\/p>\n<p><strong>Creating the control script<\/strong><br \/>\nThe control script:<span class=\"Apple-converted-space\">\u00a0<\/span><em>\/lib\/svc\/method\/samba<\/em><span class=\"Apple-converted-space\">\u00a0<\/span>will contain the following:<\/p>\n<p>bash-3.00# cat &gt; \/lib\/svc\/method\/samba<br \/>\n<code><br \/>\n#! \/sbin\/sh<br \/>\n#<\/code><\/p>\n<p>. \/lib\/svc\/share\/<span class=\"skimlinks-unlinked\">smf_include.sh<\/span><\/p>\n<p>case \u201c$1\u201d in<br \/>\n\u2018start\u2019)<br \/>\necho \u2018Starting samba services: \u2018<br \/>\n\/usr\/sfw\/sbin\/smbd -s \/etc\/sfw\/smb-<strong>&lt;server_name&gt;.<\/strong>conf -D<br \/>\n\/usr\/sfw\/sbin\/nmbd -s \/etc\/sfw\/smb-<strong>&lt;server_name&gt;<\/strong>.conf -D<br \/>\n;;<br \/>\n\u2018stop\u2019)<br \/>\n\/usr\/bin\/pkill smbd<br \/>\n\/usr\/bin\/pkill nmbd<br \/>\nexit 0<br \/>\n;;<br \/>\n\u2018refresh\u2019)<br \/>\necho \u2018Refreshing samba services:\u2019<br \/>\n\/usr\/bin\/pkill -HUP smbd<br \/>\n\/usr\/bin\/pkill -HUP nmbd<br \/>\nexit 0<br \/>\n;;<br \/>\n*)<br \/>\necho \u201cUsage: $0 { start | stop | refresh }\u201d<br \/>\nexit 1<br \/>\n;;<br \/>\nesac<br \/>\n#EOF<\/p>\n<p><strong>Change Permissions and ownership for the Control Script:<\/strong><br \/>\n<code>The control script needs to be executable.<\/code><\/p>\n<p><code>bash-3.00# ls -l \"\/lib\/svc\/method\/samba\"<br \/>\n-rw-r--r-- 1 root root 465 Feb 12 13:52 \/lib\/svc\/method\/samba<br \/>\nbash-3.00# chown :bin \"\/lib\/svc\/method\/samba\"<br \/>\nbash-3.00# chmod +x \"\/lib\/svc\/method\/samba\"<br \/>\nbash-3.00# ls -l !$<br \/>\nls -l \"\/lib\/svc\/method\/samba\"<br \/>\n-rwxr-xr-x 1 root bin 465 Feb 12 13:52 \/lib\/svc\/method\/samba<br \/>\n<\/code><\/p>\n<p><strong>The manifest: \/var\/svc\/manifest\/network\/<span class=\"skimlinks-unlinked\">samba.xml<\/span><\/strong><\/p>\n<p>Create the manifest file and edit where appropiate:<\/p>\n<p>bash-3.00# cat &gt; \/var\/svc\/manifest\/network\/<span class=\"skimlinks-unlinked\">samba.xml<\/span><br \/>\n&lt;?xml version=\u201d1.0??&gt;<br \/>\n&lt;!DOCTYPE service_bundle SYSTEM \u201c\/usr\/share\/lib\/xml\/dtd\/service_bundle.dtd.1?&gt;<br \/>\n&lt;service_bundle type=\u201dmanifest\u201d name=\u201dSUNWsmbar:samba\u201d&gt;<br \/>\n&lt;service name=\u201dnetwork\/samba\u201d type=\u201dservice\u201d version=\u201d1?&gt;<br \/>\n&lt;create_default_instance enabled=\u201dfalse\u201d\/&gt;<br \/>\n&lt;single_instance\/&gt;<br \/>\n&lt;!\u2013<br \/>\nFirst of all, if the config file is not present,<br \/>\nthen we needn\u201dt bother with anything else.<br \/>\n\u2013&gt;<br \/>\n&lt;dependency name=\u201dconfig-file\u201d grouping=\u201drequire_all\u201d restart_on=\u201dnone\u201d type=\u201dpath\u201d&gt;<br \/>\n&lt;service_fmri value=\u201dfile:\/\/\/etc\/sfw\/smb-<strong>server_name<\/strong>.conf\u201d\/&gt;<br \/>\n&lt;\/dependency&gt;<\/p>\n<p>&lt;!\u2013<br \/>\nIf there\u201ds no network, then there\u201ds no point in running<br \/>\n\u2013&gt;<br \/>\n&lt;dependency name=\u201dloopback\u201d grouping=\u201drequire_all\u201d restart_on=\u201derror\u201d type=\u201dservice\u201d&gt;<br \/>\n&lt;service_fmri value=\u201dsvc:\/network\/loopback:default\u201d\/&gt;<br \/>\n&lt;\/dependency&gt;<br \/>\n&lt;dependency name=\u201dphysical\u201d grouping=\u201doptional_all\u201d restart_on=\u201derror\u201d type=\u201dservice\u201d&gt;<br \/>\n&lt;service_fmri value=\u201dsvc:\/network\/physical:default\u201d\/&gt;<br \/>\n&lt;\/dependency&gt;<\/p>\n<p>&lt;!\u2013<br \/>\nSince Samba may be providing a home directory service,<br \/>\nit is as well that we ensure that the file-systems are<br \/>\nall mounted before it is started. This is not essential<br \/>\nbut in general it is a good thing and doesn\u201dt really hurt.<br \/>\n\u2013&gt;<br \/>\n&lt;dependency name=\u201dfs-local\u201d grouping=\u201drequire_all\u201d restart_on=\u201dnone\u201d type=\u201dservice\u201d&gt;<br \/>\n&lt;service_fmri value=\u201dsvc:\/system\/filesystem\/local\u201d\/&gt;<br \/>\n&lt;\/dependency&gt;<\/p>\n<p>&lt;!\u2013<br \/>\nnow we have the start stop and refresh methods<br \/>\n\u2013&gt;<br \/>\n&lt;exec_method type=\u201dmethod\u201d name=\u201dstart\u201d exec=\u201d\/lib\/svc\/method\/samba start\u201d timeout_seconds=\u201d60?\/&gt;<br \/>\n&lt;exec_method type=\u201dmethod\u201d name=\u201dstop\u201d exec=\u201d\/lib\/svc\/method\/samba stop\u201d timeout_seconds=\u201d60?\/&gt;<br \/>\n&lt;exec_method type=\u201dmethod\u201d name=\u201drefresh\u201d exec=\u201d\/lib\/svc\/method\/samba refresh\u201d timeout_seconds=\u201d60?\/&gt;<\/p>\n<p>&lt;property_group name=\u201dsamba\u201d type=\u201dapplication\u201d&gt;<br \/>\n&lt;stability value=\u201dEvolving\u201d\/&gt;<br \/>\n&lt;\/property_group&gt;<br \/>\n&lt;property_group name=\u201dstartd\u201d type=\u201dframework\u201d&gt;<br \/>\n&lt;propval name=\u201dignore_error\u201d type=\u201dastring\u201d value=\u201dcore,signal\u201d\/&gt;<br \/>\n&lt;\/property_group&gt;<\/p>\n<p>&lt;stability value=\u201dEvolving\u201d\/&gt;<br \/>\n&lt;!\u2013<br \/>\nA description of the Service<br \/>\n\u2013&gt;<br \/>\n&lt;template&gt;<br \/>\n&lt;common_name&gt;<br \/>\n&lt;loctext xml:lang=\u201dC\u201d&gt;Samba Server&lt;\/loctext&gt;<br \/>\n&lt;\/common_name&gt;<br \/>\n&lt;documentation&gt;<br \/>\n&lt;manpage title=\u201dsamba\u201d section=\u201d1M\u201d\/&gt;<br \/>\n&lt;doc_link name=\u201dsamba.org\u201d uri=\u201d<a href=\"http:\/\/www.samba.org\/docs\/%E2%80%9D\/&amp;gt\" rel=\"nofollow\">http:\/\/www.samba.org\/docs\/\u201d\/&amp;gt<\/a>;<br \/>\n&lt;\/documentation&gt;<br \/>\n&lt;\/template&gt;<br \/>\n&lt;\/service&gt;<br \/>\n&lt;\/service_bundle&gt;<br \/>\n# EOF<\/p>\n<pre><\/pre>\n<p><strong>Double-check the manifest for errors<\/strong><br \/>\n<code><br \/>\nbash-3.00# svccfg validate \/var\/svc\/manifest\/network\/samba.xml<br \/>\nbash-3.00#<br \/>\n<\/code><\/p>\n<p>If there are errors in the file you will get an error like the below, just double-check the file for correctness. If no complaints from validating then all should be good.<span class=\"Apple-converted-space\">\u00a0<\/span><code><br \/>\nbash-3.00# svccfg validate \/var\/svc\/manifest\/network\/samba.xml<br \/>\n<strong>svccfg: couldn't parse document<\/strong><br \/>\n<\/code><\/p>\n<p><strong>Importing the Manifest in order to start and stop samba<\/strong><br \/>\n<code><br \/>\nbash-3.00# svccfg import \/var\/svc\/manifest\/network\/samba.xml<br \/>\nbash-3.00#<br \/>\n<\/code><\/p>\n<p><strong>Enabling Samba<span class=\"Apple-converted-space\">\u00a0<\/span><\/strong><br \/>\n<code><br \/>\nbash-3.00# svcadm -v enable samba<br \/>\nsvc:\/network\/samba:default enabled.<br \/>\nbash-3.00# svcs | grep samba<br \/>\nonline 14:31:10 svc:\/network\/samba:default<br \/>\nbash-3.00# svcs -l samba<br \/>\nfmri svc:\/network\/samba:default<br \/>\nname Samba Server<br \/>\nenabled true<br \/>\nstate online<br \/>\nnext_state none<br \/>\nstate_time Mon Feb 12 14:31:10 2007<br \/>\nlogfile \/var\/svc\/log\/network-samba:default.log<br \/>\nrestarter svc:\/system\/svc\/restarter:default<br \/>\ncontract_id 31<br \/>\ndependency require_all\/none file:\/\/\/etc\/sfw\/smb-<strong>server_name<\/strong>.conf (online)<br \/>\ndependency require_all\/error svc:\/network\/loopback:default (online)<br \/>\ndependency optional_all\/error svc:\/network\/physical:default (online)<br \/>\ndependency require_all\/none svc:\/system\/filesystem\/local (online)<\/code><\/p>\n<p>If all want well, verify that samba is running by trying to access a share through Windows (<strong>Start-&gt;Run<\/strong>, then enter the name of your server. E.g.,<span class=\"Apple-converted-space\">\u00a0<\/span><strong>\\\\server_name<\/strong>). You can also check the output of ps, though this may not mean everything is working.<\/p>\n<p>bash-3.00# ps -ef | grep smb<br \/>\nroot 269 1 0 14:31:10 ? 0:00 \/usr\/sfw\/sbin\/smbd -s \/etc\/sfw\/smb-<strong>server_name<\/strong>.conf -D<br \/>\nroot 273 269 0 14:31:10 ? 0:00 \/usr\/sfw\/sbin\/smbd -s \/etc\/sfw\/smb-<strong>server_name<\/strong>.conf -D<br \/>\nroot 276 1 0 14:31:10 ? 0:00 \/usr\/sfw\/sbin\/nmbd -s \/etc\/sfw\/smb-<strong>server_name<\/strong>.conf -D<br \/>\nroot 688 643 0 15:26:59 pts\/1 0:00 grep smb<br \/>\n<strong>Removing the older samba rc* files<\/strong><br \/>\n<code>Ok. If everything sent well, then old samba rc* files can be removed, but they do not have to be.<\/code><\/p>\n<p><code>bash-3.00# rm -i \/etc\/rc?.d\/???samba<br \/>\nrm: remove \/etc\/rc0.d\/K03samba (yes\/no)? yes<br \/>\nrm: remove \/etc\/rc1.d\/K03samba (yes\/no)? yes<br \/>\nrm: remove \/etc\/rc2.d\/K03samba (yes\/no)? yes<br \/>\nrm: remove \/etc\/rc3.d\/S90samba (yes\/no)? yes<br \/>\nrm: remove \/etc\/rcS.d\/K03samba (yes\/no)? yes<br \/>\n<\/code><\/p>\n<p><strong>Don\u2019t forget to remove \/etc\/init.d\/samba<\/strong><br \/>\n<code><br \/>\nbash-3.00# rm -i \/etc\/init.d\/samba<br \/>\nrm: remove \/etc\/init.d\/samba (yes\/no)? yes<br \/>\nbash-3.00#<\/code><\/p>\n<p>The below resources helped me greatly and provide more in depth information than what I provide here.<\/p>\n<p>URL:<span class=\"Apple-converted-space\">\u00a0<\/span><a href=\"http:\/\/forum.sun.com\/jive\/thread.jspa?threadID=106458&amp;messageID=366067\" rel=\"nofollow\">http:\/\/forum.sun.com\/jive\/thread.jspa?threadID=106458&amp;messageID=366067<\/a><br \/>\nURL:<span class=\"Apple-converted-space\">\u00a0<\/span><a href=\"http:\/\/blogs.sun.com\/tdw\/date\/20050211#more_smf\" rel=\"nofollow\">http:\/\/blogs.sun.com\/tdw\/date\/20050211#more_smf<\/a><br \/>\nURL:<span class=\"Apple-converted-space\">\u00a0<\/span><a href=\"http:\/\/www.sunfreeware.com\/sshsol10.html\" rel=\"nofollow\">http:\/\/www.sunfreeware.com\/sshsol10.html<\/a><br \/>\nURL:<span class=\"Apple-converted-space\">\u00a0<\/span><a href=\"http:\/\/www.oreillynet.com\/pub\/a\/sysadmin\/2006\/04\/13\/using-solaris-smf.html?page=4\" rel=\"nofollow\">http:\/\/www.oreillynet.com\/pub\/a\/sysadmin\/2006\/04\/13\/using-solaris-smf.html?page=4<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I am a bit new to the Service Management Facility (SMF) introduced into Solaris 10, but after getting my feet wet I kinda like it. These steps came in handy for me when I needed to add Samba to SMF.<\/p>\n<p>Backup and Remove samba rc* scripts bash-3.00# tar cvpf &#8211; \/etc\/rc?.d\/???samba | gzip -c &gt; [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[39],"tags":[],"_links":{"self":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/5098"}],"collection":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5098"}],"version-history":[{"count":1,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/5098\/revisions"}],"predecessor-version":[{"id":5099,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/5098\/revisions\/5099"}],"wp:attachment":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5098"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5098"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5098"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}