CHGNFSEXP (Change Network File System Export)
CHGNFSEXP Command syntax diagram
Purpose
The Change Network File System Export (CHGNFSEXP) command adds directory names to (exports) or removes directory names from (unexports) the list of directory trees that are currently exported to Network File System (NFS) clients. The flags in the OPTIONS list indicate what actions you want the CHGNFSEXP command to perform.
A list of directories and options for exporting the directory and its contents is stored in the /etc/exports file. The CHGNFSEXP command allows you to export all of the directory trees specified in the file using the -A flag, or to export a single directory tree by specifying the directory name. When the directory tree being exported exists in the /etc/exports file, you can export it with the options specified there, or you can use the -I flag to override the options, specifying the new options on the CHGNFSEXP command.
You can also export a directory tree not previously defined in the /etc/exports file by providing the options for it on the CHGNFSEXP command. You can unexport directory trees by using the -U flag on the CHGNFSEXP command.
You can also add, change, or remove export entries in the /etc/exports file by using the -F flag.
This command can also be issued using the following alternative command name:
For more information about Network File System commands, see the OS/400 Network File System Support book.
Restrictions
The following restrictions apply when changing export entries:
- The user must have *IOSYSCFG special authority to use this command.
- The user must have read (*R) and write (*W) data authority to the /etc directory.
- The user must have read and write access (*RW) to the /etc/exports file when using the -F flag.
Optional Parameters
Note: A value (other than *NONE) must be specified for either the OPTIONS or DIR parameter. Both OPTIONS and DIR can be specified so long as '-A' is not part of the options list specified for the OPTIONS parameter.
- OPTIONS
- The export options list contains some flags followed optionally by a list containing a character string of characteristics for the directory tree being exported.
Each flag consists of a minus "-" followed by a character. The flags are separated by spaces. Only certain combinations of flags are allowed. If an invalid combination is detected, an error is returned.
*DFT: The default value for the options string is:
'-A'The following are the available flags:
- -A
- This is the "all" flag and it indicates that all entries in the /etc/exports file are to be processed. The following flag combinations have special significance:
- -A and not -U
- This will export every entry in the /etc/exports file (making them available to NFS clients).
- -A and -U
- This will unexport every entry that is currently exported (making them unavailable to NFS clients). This makes no reference to the contents of the /etc/exports file.
- -A and the DIR parameter
- This combination is not allowed.
- -A and (-I or -F or -O)
- These combinations are not allowed.
- -I
- This is the "ignore" flag and it indicates, for the directory tree specified in the DIR parameter, how the export characteristics are determined. The following flag combinations have special significance:
- -I and -O
- The export characteristics specified on the -O flag are used, and the definitions listed in the /etc/exports, if they exist, are ignored.
- not -I and not -O
- Either the export characteristics listed for the entry in the /etc/exports file are used, or, if there are no options in that file, the default options are assumed. See the -O flag description for the list of default options.
- -I and (-A or -U)
- These combinations are not allowed.
- -U
- This is the "unexport" flag and it indicates that the specified directory tree entered in the DIR parameter is to be unexported (made unavailable to NFS clients). The following flag combinations have special significance:
- -U and -A
- This will unexport every entry that is currently exported (making them unavailable to NFS clients). This makes no reference to the contents of the /etc/exports file.
- -U and -F
- The entry referenced in the DIR parameter is removed from the /etc/exports file (if it exists) in addition to being unexported (making it unavailable to NFS clients).
- -U and (-I or -O)
- These combinations are not allowed.
- -F
- This is the "file" flag and it requires the DIR parameter. The following flag combinations have special significance:
- -F and -U
- The entry referenced in the DIR parameter is removed from the /etc/exports file (if it exists) in addition to being unexported (making it unavailable to NFS clients).
- -F and not -U and not -O
- The specified directory tree entered in the DIR parameter is to be exported (made available to NFS clients). In addition, an entry for this directory tree entered in the DIR parameter will be added to the /etc/exports file. If the entry already exists in the file, it will be replaced with this new export entry. If the file does not exist, it will be created and the export entry will be added to it. Note that the "ignore" flag -I is implied when the "file" flag -F is specified without the "unexport" flag -U. Since the "options" flag -O is not specified, the default options are assumed. See the -O flag description for the list of default options.
- -F and not -U and -O
- The specified directory tree entered in the DIR parameter is to be exported (made available to NFS clients). In addition, an entry for this directory tree entered in the DIR parameter will be added to the /etc/exports file. If the entry already exists in the file, it will be replaced with this new export entry. If the file does not exist, it will be created and the export entry will be added to it. Note that the "ignore" flag -I is implied when the "file" flag -F is specified without the "unexport" flag -U. All export characteristic options provided with the "options" flag -O are stored in the /etc/exports file as given on the command.
- -F and -A
- This combination is not allowed.
Note: Successful use of the -F flag will cause the contents of the /etc/exports file to be replaced completely such that it reflects the changes, additions, or deletions caused by the -F flag. Any unrelated existing entries are copied, however ALL comments in the /etc/exports file will be lost as a result of using the -F flag.
- -E
- This is the "escape message" flag and it indicates that an escape message should be issued if the command fails for any of the exports attempted.
- -O
- This flag specifies the export characteristics for the directory tree that is to be exported (made available to NFS clients). The options list following the -O flag list consists of keywords separated by commas. Some keywords are followed by an equal '=' and a value (or list of values separated by colons ':'). The options list may contain spaces. If a keyword is not specified, the default value for that option will be used. The -O flag is only valid when either the "ignore" flag -I or the "file" flag -F is specified.
If options are required and the -O flag is not specified, the following are the default options.
- 'RW=' All host names have read-write access to the directory tree.
- ANON=UID associated with the profile QNFSANON.
- Requests to bits in the mode other than the permission bits are allowed.
- 'ROOT=' Root access is not allowed for any hosts.
- 'ACCESS=' All clients are allowed to mount the directory.
The following are the available options keywords and their descriptions.
- RO
- Specifies the protection for the exported directory tree. If RO is specified, the directory tree is exported allowing only read-only access to the directory and its contents. If it is not specified, read-write access is allowed to the directory and its contents.
- RW=[HOSTNAME[:HOSTNAME:]](...)
- Specifies the host name or host names which will be allowed read-write access to the exported directory and its contents. For host names not specified, the directory and its contents will be exported allowing only read-only access.
If neither RO or RW is specified, then 'RW=' is assumed, and all host names have read-write access to the exported directory.
- ANON=UID
- If a request comes in from an unknown user, use this UID as the effective userid. Note that root users are considered unknown, unless specified on the ROOT parameter below. The default value for this option is the UID associated with the user profile QNFSANON.
If you do not want to allow any requests from unknown users, use 'ANON=-1'.
- NOSUID
- Specifies that any attempt by the client to enable bits other than the permission bits will be ignored. If this option is not specified, attempt to set bits other than the permission bits will be carried out.
- ROOT=[HOSTNAME[:HOSTNAME]](...)
- Specifies the host name or host names for which root access is allowed to the exported directory tree. If root access is allowed for a host, an incoming UID of 0 is mapped to the user profile QSECOFR, and incoming requests from users with *ALLOBJ authority are allowed. If root access is not allowed for a host, an incoming UID of 0 and incoming requests from users with *ALLOBJ authority are mapped to the UID provided in the ANON option. If the ROOT option is not specified, no hosts will be granted root access.
- ACCESS=[CLIENT[:CLIENT]](...)
- Specifies the client or clients that are allowed to mount the exported directory tree. A client can be a host name or a netgroup. If no clients are specified, all clients will be allowed to mount the directory tree.
- DIR
- Specifies the absolute path name of the existing directory to be exported (made available to NFS clients) or unexported (made unavailable to NFS clients). This directory can not be a subdirectory or a parent of an already exported directory (unless it is in a different file system). This parameter is not allowed when the -A flag is specified on the OPTIONS parameter. This parameter is required when the -F flag is specified on the OPTIONS parameter.
- HOSTOPT
- The HOSTOPT parameter has four elements that specify additional information about the NFS clients that a directory tree is being exported to. If you do not specify a HOSTOPT parameter for a host name you are exporting the directory tree to, the defaults for each of the elements of the HOSTOPT parameter are assumed for that host.
*DFT: The default values for the elements of the HOSTOPT parameter are used for all clients to which the directory tree or directory trees are being exported. The network data file CCSID is *BINARY, the network path name CCSID is *ASCII, and Force synchronous write is *SYNC.
Element 1: Host name
The name of the host for which you are specifying additional options. This host should be specified above in the OPTIONS -O list as a host that has access to the exported directory tree. Specify either a single host name that is an alias for an address of a single host or a netgroup name to be associated with these options.
You can assign names to an internet address with the Work with TCP/IP host table entries option on the Configure TCP/IP menu (CFGTCP command) or via the iSeries Navigator graphical user interface. Also, a remote name server can be used to map remote system names to internet addresses.
Element 2: Network Data File CCSID
The network data file coded character set identifier (CCSID) is used for data of the files sent and received from the specified HOST NAME (or netgroup name). For any hosts not specified on a HOSTOPT parameter, the default network data file CCSID (binary, no conversion) is used. The CCSID may be one of the following:
*BINARY: The default network data file CCSID (binary, no conversion) is used.
*ASCII: The ASCII equivalent of the coded character set identifier (CCSID) obtained from the job CCSID is used.
*JOBCCSID: The CCSID from the default job CCSID is used.
network-data-file-CCSID: Specify a coded character set identifier (CCSID) for data files. Valid values are 1 through 65533.
Element 3: Network Path Name CCSID
The network path name coded character set identifier (CCSID) is used for the path name components of the files sent to and received from the specified HOST NAME (or netgroup name). For any hosts not specified on a HOSTOPT parameter, the default network path name CCSID (ASCII) is used. The CCSID may be one of the following:
*ASCII: The ASCII equivalent of the coded character set identifier (CCSID) obtained from the default job CCSID is used.
*JOBCCSID: The CCSID from the default job CCSID is used.
network-path-name-CCSID: Specify a coded character set identifier (CCSID) for path name components of files. Valid values are 1 through 65533.
Element 4: Write mode
Specifies whether write requests are handled synchronously or asynchronously for this HOST NAME (or netgroup name). The default value of *SYNC means that data may will be written to disk immediately. *ASYNC does not guarantee that data is written to disk immediately, and can be used to improve server performance.
Note: The Network File System (NFS) protocol has traditionally used synchronous writes. *SYNC: Write requests are performed synchronously.
*ASYNC: Write requests are performed asynchronously.
Examples for CHGNFSEXP
Example 1: Exporting all entries from /etc/exports
CHGNFSEXP OPTIONS('-A') CHGNFSEXP '-A'Both of these commands export all entries that exist in the /etc/exports file.
Example 2: Exporting one directory with options
CHGNFSEXP '-I -O RO,ANON=guest1,ACCESS=Roch1:9.7.431.2' '/programs/public' HOSTOPT((MIAMI1 850 850))This command exports the directory tree under the path name /programs/public as read-only. It allows only two clients to mount this directory tree. It takes advantage of the positional parameters, which do not require keywords. It uses the HOSTOPT parameter to specify code pages for the host MIAMI1.
Example 3: Exporting one directory with options and updating the /etc/exports file.
CHGNFSEXP '-I -F -O RO,ANON=guest1,ACCESS=Roch1:9.7.431.2' '/programs/public' HOSTOPT((MIAMI1 850 850))This command exports the directory tree under the path name /programs/public as read-only. It allows only two clients to mount this directory tree. The OPTIONS parameter value is specified positionally. It uses the HOSTOPT parameter to specify data and path name coded character set identifiers (CCSIDs) of 850 for host name MIAMI1.
In addition, it also adds an export entry for /programs/public, along with the OPTIONS and HOSTOPT parameter values, to the /etc/exports file.
Error messages for CHGNFSEXP