Attachmate Worldwide  |   Contact Us  |   NetIQ.com
Home » Support » Solution Library

Technical Notes

Automatically Mapping NFS Drives Using NIS Login Scripts on Solaris
Technical Note 1831
Last Reviewed 21-Oct-2004
Applies To
Reflection NFS Client version 11.0 or higher
Summary

If your NFS network is configured to use NIS (Network Information System) for network naming and administration, you can use NIS login scripts to automatically map NFS network drives for users who are running the Reflection NFS Client. Drives mapped in this manner can be customized per user and are centrally administered from the NIS server. This technical note explains how to configure automatic drive mapping on a Solaris 8 host configured for NIS.

Note: This technique can also be used if NIS is running on a non-Solaris host configured for NIS; however, this note specifically addresses configuration in the Sun Solaris environment.

Overview

This technical note describes how to configure automatic NFS drive mapping when using Reflection NFS Client to connect to a Solaris 8.

Step 1 — Create a NIS Logon Script Map

The NIS logon script map file is a text file containing user names (keys) paired with NFS drive mappings (values).

This file is not a standard NIS configuration file, so you must create it. By default, Reflection NFS assumes that the NIS login script map file is named pcscript. This naming convention is not required; however, if you decide to give the file a different name, you must update the name specified on the NIS tab of the Reflection NFS Client Properties dialog box for each NFS client installation. For information on using the XML export/import feature to configure Reflection NFS Client installations, see Technical Note 1816.

The Pcscript File

Each line of the pcscript text file contains four possible values: user name, UNC path, drive letter, and additional groups.

Syntax: <user name> <UNC path>[:<drive letter>] [<additional groups>]

User Name

There are three types of user names that can be used in the pcscript file:

  • Existing users. Current users' NIS logon names.
  • User "default." If the user does not have a unique user name entry in the pcscript file, drive mappings specified for user "default" are applied.
  • User Groups. Groups of users who have the same drive mapping requirements.

UNC Path

The UNC path is the path to the directory you want mapped.

Drive Letter (Optional)

If a drive letter is specified, the mapped drive is mapped to the indicated letter. If no drive letter is specified, the first available drive letter is used.

Additional Groups (Optional)

Additional user groups, containing additional drive mappings, may be called. Drives specified in the additional groups will be also be mapped for this user. See example below.

Sample Pcscript File

The following is a sample pcscript file.

#----------------------------------------------------------
# default user connections
#----------------------------------------------------------
default \\mars\users\public
#----------------------------------------------------------
# individual user connections
#----------------------------------------------------------
Ben \\mars\users\Ben
Susan \\earth\users\Susan:k
Danny \\mars\users\Danny:g \\pluto\users\danny 
Linda \\mars\users\Linda Engineering
#----------------------------------------------------------
# user groups
#----------------------------------------------------------
Engineering \\mars\rover \\jupiter\lander
#----------------------------------------------------------

This file does the following:

  • If a user logs in to NIS, and the user's login name does not appear in the pcscript file, the default user settings are applied and the user's first available drive is mapped to \\mars\users\public.
  • If user Ben logs in, his first available drive is mapped to \\mars\users\Ben.
  • If user Susan logs in, her K drive is mapped to \\venus\users\Susan.
  • If user Danny logs in, his G drive is mapped to \\mars\users\Danny, and his first available drive is mapped to \\pluto\users\danny.
  • If user Linda logs in, her first available drive is mapped to \\mars\users\linda and the next two available drives are mapped to \\mars\rover and \\jupiter\lander. The last two drives are mapped because of the call to the user group 'Engineering,' where these drive mappings are defined.

Create and Save the Pcscript File

You can create the pcscript text file on your host using a text editor such as VI, or you can create the file locally in Microsoft Notepad, use the Reflection NFS ASCII file translation feature to convert the file to UNIX format, and then transfer the file to your host.

Save the file to the /etc directory.

Step 2 — Edit and Recompile the NIS Makefile

Before the NIS logon script can be used, the pcscript file must be compiled using the NIS Makefile.

Important Notes:

  • Before editing the NIS Makefile, make a backup of the existing Makefile.
  • Makefiles vary by host and vendor. The Makefile shown in this technical note is specifically tailored for a Solaris 8 host. This information may not be applicable to other versions of Sun Solaris, and is not directly applicable to other hosts. For information about your host's Makefile, refer to your host's man pages. Do not copy a Makefile from one host to another unless you have verified that the macros and syntax are identical.
  • When editing the Makefile, all indents must be tabs, not spaces.

Follow the steps below to edit /etc/Makefile.

  1. Open /etc/Makefile.
  2. Locate the "all" target and add pcscript to the list of parameters (in red below):
all: passwd group hosts ipnodes ethers networks rpc \
      services protocols netgroup bootparams aliases \
      publickey netid c2securenetmasks timezone \
      auto.master auto.home auto.home2 auth.attr \
      exec.attr prof.attr user.attr audit.user \
      auto.group pcscript

  1. Add a pcscript section to the Makefile.
pcscript.time:  $(DIR)/pcscript
        -@if [ -f $(DIR)/pcscript ]; then \
                sed -e "/^#/d" -e s/#.*$$// $(DIR)/pcscript \
                | $(MAKEDBM) - $(YPDBDIR)/$(DOM)/pcscript.byuser; \
                touch pcscript.time; \
                echo "updated pcscript"; \
                if [ ! $(NOPUSH) ]; then \
                        $(YPPUSH) pcscript.byuser; \
                        echo "pushed pcscript"; \
                else \
                : ; \
                fi \
        else \
                echo "couldn't find $(DIR)/pcscript"; \
        fi
pcscript: pcscript.time
$(DIR)/pcscript:
# New pcscript ends here 

  1. Save the file.
  2. Navigate to the /var/yp directory and issue the make command.

Step 3 — Test the Changes to the NIS Database

Use the following UNIX ypcat command to verify that the changes to the Makefile worked.

ypcat -k pcscript.byuser

Note the following:

  • The ypcat –k parameter causes the keys (user names) to be displayed.
  • The user order in the map does not necessarily match the order in the source file (pcscript).

Sample ypcat response:

bluebell% ypcat -k pcscript.byuser
Default Default \\mars\users\default
Ben Ben \\mars\users\ben
Susan Susan \\earth\users\susan:k
Danny Danny \\mars\users\danny:g \\pluto\users\danny
Linda Linda \\mars\users\linda Engineering
Engineering Engineering \\mars\rover \\jupiter\lander

Step 4 — Configure Reflection NFS to Use the NIS Logon Script

Navigate to the Reflection NFS Network Control Panel and enable NIS Logon Script Processing. You will then need to reboot your machine (or simply "close all programs and log on as a different user?") to see the logon script run.

Follow the steps below to enable NIS login script support in Reflection NFS Client.

Note: These steps assume that NIS support has already been enabled in Reflection NFS. For steps to enabe NIS support in Reflection NFS Client, see the Reflection NFS Client help.

  1. Open the Reflection NFS Utility.
  2. Click View > Settings.
  3. On the NIS tab, select the NIS login script processing checkbox.
  4. Accept the default NIS login script name, pcscript.byuser. Or, if your NIS login script has a different name, enter that name here and append the .byuser extention to the end. For example, ReflectionLoginScript.byuser.
Related Technical Notes
1816 Exporting and Importing an NFS XML Settings File
5008 Technical Notes for Reflection NFS Products

Did this technical note answer your question?

Yes    No    Somewhat     Not sure yet

Additional comments about this tech note:

Need further help? For technical support, please contact Support.