|Skip Navigation Links|
|Exit Print View|
|Managing SMB File Sharing and Windows Interoperability in Oracle Solaris 11.1 Oracle Solaris 11.1 Information Library|
The SMB server provides a set of service properties to support the execution of a command or script when SMB shares are connected or disconnected. These properties are configurable with the sharectl command and are applied to all shares. You can use the command or script to perform automated administrative tasks each time a share is mapped (connected) or unmapped (disconnected). These scripts and commands must be run as superuser. For example, you might use a command to create home directories or to monitor resources.
You must be superuser or assume an equivalent role to obtain the solaris.smf.modify.application RBAC authorization to use sharectl to configure these properties.
The service property names and values are as follows:
map. The value of this property is a command to be executed when the client connects to the share. The command can take the following arguments, which are substituted when the command is executed by exec():
%D – Domain or workgroup name of %U.
%h – Server host name.
%I – IP address of the client system.
%i – Local IP address to which the client is connected.
%L – Server NetBIOS name.
%M – Client host name, or “” if not available.
%m – Client NetBIOS name, or “” if not available. This option is only valid for NetBIOS connections (port 139).
%P – Root directory of the share.
%S – Share name.
%U – Windows user name.
%u – UID of the UNIX user.
unmap. The value of this property is a command to be executed when the client disconnects from the share. The command can use the same arguments that are described for the map property.
disposition=[continue|terminate]. This property controls whether to disconnect the share or proceed if the map command fails. This property only has meaning when the map property has been set. Otherwise, it has no effect.
The following are valid values for the disposition property:
continue – Proceed with the share connection if the map command fails. This is the default behavior when the disposition property is not specified.
terminate – Disconnect the share if the map command fails.
Example 1-2 Using SMB Share Execution Properties
The following sharectl examples show how you might set the map, unmap, and disposition properties:
# sharectl set -p map="/tmp/map_script %U" smb # sharectl set -p unmap=/tmp/unmap_script smb # sharectl set -p disposition=terminate smb
The first command runs the /tmp/map_script Windows-username command when a share is mapped. The second command runs the /tmp/unmap_script command when a share is unmapped. The third command specifies that the share will disconnect if the command fails during the mapping operation.