Skip to main content

Share Configuration

The second-level help menu displays the subcommands supported by the first-level commands.

For example, in dynamic share configuration, the second-level help menu for the ‘share’ commands is:

$ /usr/bin/tsmb-cfg share help

Usage: tsmb-cfg share <COMMAND> [PARAMETERS]

Available share commands are:

  • ‘add’ – Register a share in the server
  • ‘del’ – Delete a share from the server
  • ‘update’ – Update an existing share in the server
  • ‘list’ – List existing shares in the server
  • ‘help’ – Display this help info

Use ‘tsmb-cfg share COMMAND [-h|--help]’ for more command-specific information.

Adding a New Share

You can register a new share using the ‘add’ subcommand. For a list of supported options, run:

$ /usr/bin/tsmb-cfg share add -h

By default, registering a new share requires some mandatory options like the path of the shared resource and netname (used to identify the shared resource over the network).

Example:

$ /usr/bin/tsmb-cfg share add -n <name of share> -p <path to share>

You may also use the following optional parameters with the ‘add’ subcommand:

TitleTitle
--administrative BOOLSet the share as an administrative share. These are special shares like C$ or D$ that represent the root of a volume. Default: false
--audit-level NUMLevel of audit logging for the share.
--ca BOOLEnable continuous availability on the share. Default: false
--ca-params STRCA parameters. MANDATORY for continuously available shares.
--dfs BOOLEnable DFS on the share. Default: false
--vss BOOLEnable VSS on the share. Default: false
--vss-params STRVSS parameters
--case-insensitive BOOLEnable case-insensitive access on the share. Default: false
--force-l2oplock BOOLEnable issuing of exclusive caching rights on share. Default: false
--encrypt BOOLEnable encryption on share. Default: false
--access-based-enumeration BOOLEnable access permission based hiding of directory contents during enumeration. Default: false
--permissions STRShare access permissions. Default: ”every-one:read
--security-descriptor STRShare access permissions in SDDL format.
--remark STRAdditional information about the shared resource.
--type STRType of the share to be added. Default: ”disk”
--files-allow STRSet of patterns used as a filter to allow accessing and listing files and directories
--files-deny STRSet of patterns used as a filter to deny accessing and listing files and directories.
--compression-deny STRSet of patterns to recognize files for which compression should not be performed.
--map-attributes STRMethod for storing SMB file attributes.
--map-acls STRMethod for storing ACLs.
--security STRShare security model.
--vfs STRVFS parameters in the following format: <type>:[<parameter=value>,*]´, where type is VFS type to use for the share.
--vfs-zerocopy-write BOOLEnable zero-copy writes if supported. Default: true
--vfs-zerocopy-read BOOLEnable zero-copy reads if supported. Default: true
--vfs-clone-file-range BOOLEnable clone_file_range for server side copy if supported. Default: true
--vfs-data-threads NUMThe number of share specific VFS data threads.
--vfs-metadata-threads NUMThe number of share specific VFS metadata threads.
--vfs-fallocate-min NUMMinimum threshold (in bytes) for using fallocate() system call.
--vfs-fallocate-max NUMMaximum threshold (in bytes) for using fallocate() system call.
--create-mask MASKMaximum allowed POSIX permission for a file. If not specified then no mask is applied.
--force-create-mode MASKMinimal required POSIX permissions for a file. If not specified then no mask is applied.
--directory-mask MASKMaximum allowed POSIX permission for a directory. If not specified then no mask is applied.
--force-directory-mode MASKMinimal required POSIX permissions for a directory. If not specified then no mask is applied.
--enable-oplock BOOLSet oplocks (leases) on a share. Default: true

Refer to the help (--help) for a more detailed explanation.

Deleting a Share

You can delete an existing share using the ‘del’ subcommand. Run the following for a list of parameters or options supported by ‘del’:

$ /usr/bin/tsmb-cfg share del -h

To delete a share, run:

$ /usr/bin/tsmb-cfg share del -n <name_of_share>
note

A delete operation performed on a non-existent share will fail.

Updating a Share

You can change the configuration for an existing share using the ‘update’ subcommand.

Run the following for a list of parameters or options supported by ‘update’:

$ /usr/bin/tsmb-cfg share update -h

You may ‘update’ an existing share with the following parameters:

TitleTitle
-n, --name=STRINGNetname to identify the shared resource [Mandatory]
--force-l2oplock BOOLEnable issuing exclusive caching rights on share. Default: false
--encrypt BOOLEnable encryption on share. Default: false
--access-based-enumeration BOOLEnable access permission based hiding of directory contents during enumeration. Default: false
--permissions STRShare access permissions. Default: ”everyone:read
--security-descriptor STRShare access permissions in SDDL format.
--remark STRAdditional information about the shared resource.
--files-allow STRSet of patterns used as a filter to allow accessing and listing files and directories. Each entry in the filter MUST be separated by a pipe ‘ | ’ and each entry can contain characters such as ‘ ? ’ and ‘ * ’ to denote wildcards when filters multiple files.
--files-deny STRSet of patterns used as a filter to deny accessing and listing files and directories.
--compression-deny STRSet of patterns to recognize files for which compression should not be performed.
--vfs-params STRSet new values of VFS parameters on the share. Parameters are in the following format: [<parameter=value>,*]
--case-insensitive BOOLSet case-insensitive access on the share.
--create-mask MASKMaximum allowed POSIX permission for a regular file.
--force-create-mode MASKMinimal required POSIX permissions for a file.
--directory-mask MASKMaximum allowed POSIX permission for a directory.
--force-directory-mode MASKMinimal required POSIX permissions for a directory.
--enable-oplock BOOLSet oplocks (leases) on a share. Default: true
--helpDisplay help message.

There are limitations on the options that can be updated using this command. These limitations are imposed by the protocol’s technical document. The tool allows you to dynamically update the user permissions and the remark associated with an existing share. This limitation is imposed so that if a user is connected to an existing share, the user does not need to reconnect to the share to notice the effects of the new user-permissions. The changes are effective immediately on-the-fly.

During an update if certain fields are not specified, then the unspecified fields will be left untouched in the server.

Listing Shares

You can list all the existing shares using the ‘list’ subcommand. Run the following for a list of available options:

$ /usr/bin/tsmb-cfg share list -h

The supported parameter(s) to ‘list’ all existing shares are:

TitleTitle
--info-level NUMThe info level to retrieve while listing share(s) [DEFAULT: 1] The supported levels are:
  1. - To list shares with netname and server name.
  2. - To list shares with the options set in configuration file.
--format STRSpecify the format in which to output the share info. The supported formats are: raw, json [DEFAULT: raw]
-n STR, --name STRFilter share based on netname when listing.
--server STRFilter share(s) based on server when listing scoped share(s.)
--helpDisplay help message.