System Administration Guide: Network Services

ProcedureHow to Set Up Automatic File-System Sharing

Starting with the Solaris Express, Developer Edition 2/07 release, you can do the following:


Note –

When you use sharemgr, you do not need to use the share, shareall, and unshare commands. Also, you do not need to edit the /etc/dfs/dfstab file.


The following procedure uses the sharemgr utility. If you prefer to use the share and shareall utilities, see the example that follows this procedure. Note that whether you use sharemgr or share and shareall, you must set up your autofs maps so that clients can access the file systems that you have shared on the server.

  1. Become superuser or assume an equivalent role.

    Roles contain authorizations and privileged commands. For more information about roles, see Configuring RBAC (Task Map) in System Administration Guide: Security Services. To configure a role with the Primary Administrator profile, see Chapter 2, Working With the Solaris Management Console (Tasks), in System Administration Guide: Basic Administration.

  2. Use the sharemgr utility to assign property values to the file system to be shared.

    1. Use the following syntax to create a share group with the desired property value.


      # sharemgr create [-P protocol] [-p property=value] share-group
    2. Use the following syntax to add shares to the share group.


      # sharemgr add-share -s share-path [-t] [-d description] [-r resource-name] share-group
    3. (Optional) If necessary, use the following syntax to set more property values to an existing share group.


      # sharemgr set [-P protocol] [-S security-mode] [-p property=value] share-group

      Note –

      You do not need to repeat this command-line syntax for each additional property value. You can use the -p option multiple times to define multiple properties on the same command line.


  3. Use the sharemgr utility to verify what you have created by using the following syntax.


    # sharemgr show [-v] [-p] [-x] [share-group...]

Example 5–1 How to Use the share and shareall Commands to Set Up Automatic File-System Sharing

  1. Become superuser or assume an equivalent role.

    Roles contain authorizations and privileged commands. For more information about roles, see Configuring RBAC (Task Map) in System Administration Guide: Security Services. To configure a role with the Primary Administrator profile, see Chapter 2, Working With the Solaris Management Console (Tasks), in System Administration Guide: Basic Administration.

  2. Add entries for each file system to be shared.

    Edit /etc/dfs/dfstab. Add one entry to the file for every file system that you want to be automatically shared. Each entry must be on a line by itself in the file and use this syntax:


    share [-F nfs] [-o specific-options] [-d description] pathname

    See the dfstab(4) man page for a description of /etc/dfs/dfstab and the share_nfs(1M) man page for a complete list of options.

  3. Share the file system.

    After the entry is in /etc/dfs/dfstab, you can share the file system by either rebooting the system or by using the shareall command.


    # shareall
    
  4. Verify that the information is correct.

    Run the share command to check that the correct options are listed:


    # share
    -        /export/share/man   ro   ""
    -        /usr/src     rw=eng   ""
    -        /export/ftp    ro,public  ""

See Also

Whether you use sharemgr or share and shareall, the next step is to set up your autofs maps so that clients can access the file systems that you have shared on the server. See Task Overview for Autofs Administration.