Solaris CIFS Administration Guide

ProcedureHow to Add an Automounter Entry for a CIFS Share

You can add a CIFS share to an automount map, such as the /etc/auto_direct file, so that the share will be automatically mounted when a user accesses the mount point. You cannot add these automount entries to the /etc/auto_master file.

To successfully use the automount feature, you must store a persistent password for authentication to mount the share. See How to Store a CIFS Persistent Password.


Caution – Caution –

When a user mounts a remote CIFS share by using smbfs, all accesses through that mount, even by other users, are as the user who established the mount.

For shares that will only be used by the owner, you should restrict access to the share by using the dirperms mount option to ensure that only the owner can access the share.


  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. Edit the /etc/auto_master file to refer to the automount map.

    For example, to add automount entries to the /etc/auto_direct file, add the following line to the /etc/auto_master file:

    /-	auto_direct
  3. Edit the automount map to add the mapping.

    The following examples show the changes to the automount map, in this example the /etc/auto_direct file, to configure automount maps.

    • To configure a private automount (a share that will only be accessed by the owner) of the //solarsystem/test share on the /sam-test mount point, create the following entry in the /etc/auto_direct file:

      /sam-test -fstype=smbfs,dirperms=0700,uid=sam //solarsystem/test

      The dirperms=0700 mount option ensures that only the owner can access the share. The uid=sam mount option ensures that the share root and everything in the share is owned by user sam.

    • To configure a public automount of the //solarsystem/public share on the /PUBLIC mount point, create the following entry in the /etc/auto_direct file:

      /PUBLIC -fstype=smbfs //solarsystem/public

      The dirperms=0555 mount option ensures that everyone has read and execute access to the share.

    • To configure a public automount of a share and to specify the password to be used for authentication, create the following entry in the /etc/auto_direct file:

      /PUBLIC -fstype=smbfs //guest:guest@solarsystem/public

      This entry specifies that all access to the //solarsystem/public share is done as the user guest and uses the specified password, which in this example is guest. The dirperms=0777 mount option ensures that everyone has read, write, and execute access to the share.

    • To configure a public automount of a share that can be accessed anonymously, which does not require a password, specify the noprompt option:

      /PUBLIC -noprompt,fstype=smbfs //solarsystem/public

      The noprompt mount option suppresses the prompting for a password when mounting the share. The dirperms=0555 mount option ensures that everyone has read and execute access to the share.

  4. Run the automount command to read the /etc/auto_master file.


    # automount
    
  5. Access the automounted share.

    The share is automounted when a user accesses the mounted share, such as by using the ls or cd command.


    $ ls /PUBLIC
    bin docs

    After the CIFS share is mounted, a user can use regular Solaris commands to access the files. Automounted shares are automatically unmounted after a period of inactivity.