exportfs 명령어 (AIX 5.3·6.1)
https://archive.horanglab.com/posts/aix-cmd-exportfs
핵심 정리
- 로컬 디렉터리를 NFS 클라이언트가 마운트할 수 있게 내보냅니다(export). 보통 부팅 때
/etc/rc.nfs가/etc/exports를 읽어 실행합니다. exportfs(지금 내보낸 목록,/etc/xtab),exportfs -a(/etc/exports의 모두 내보내기),exportfs 디렉터리(하나),exportfs -u 디렉터리(거두기),exportfs -ua(모두 거두기)./etc/exports형식:/data -rw=host1:host2,root=host1,access=host1:host2. 고친 뒤exportfs -a(또는 그 디렉터리)로 다시 내보냅니다./etc/xtab은 직접 고치지 않습니다.-i -o 옵션으로/etc/exports에 없거나 다른 옵션으로 임시로 내보낼 수 있습니다. 영구로 하려면mknfsexp나smitty mknfsexp를 씁니다.-V 3,-V 4,-V 3:4로 NFS 버전별로 내보내거나 거둡니다. 내보낸 것은 클라이언트에서showmount -e 서버로 확인합니다.
| 항목 | 내용 |
|---|---|
| 버전 | AIX 5.3, AIX 6.1 (두 버전의 내용이 같고, 6.1 문서에 RBAC 안내가 더해짐) |
| 원문 | IBM Commands Reference — 5.3 Volume 2, 6.1 Volume 2 |
| 파일 | /usr/sbin/exportfs, /etc/exports, /etc/xtab, /etc/netgroup, /etc/rc.nfs |
| 관련 명령어 | mknfsexp, chnfsexp, rmnfsexp, showmount, chnfs, nfso, mount |
목적
NFS 클라이언트에 디렉터리를 내보내거나 거둡니다.
영어 원문
Exports and unexports directories to NFS clients.
구문
/usr/sbin/exportfs [ -a ] [ -v ] [ -u ] [ -i ] [ -f File ] [ -F ] [ -o Option [ ,Option ... ] ]
[ -V Exported Version ] [ Directory ]
설명
exportfs 명령은 로컬 디렉터리를 NFS(Network File System) 클라이언트가 마운트할 수 있게 합니다. 보통 시스템을 시작할 때 /etc/rc.nfs가 실행하며, /etc/exports의 정보로 디렉터리를 하나 이상 내보냅니다. 디렉터리는 전체 경로로 지정해야 합니다.
/etc/xtab에는 지금 내보낸 디렉터리가 있습니다. 이 파일을 보려면 플래그와 인수 없이 exportfs를 실행합니다. 파일이나 그 안의 디렉터리 특성을 바꾸려면 root가 /etc/exports를 고치고 exportfs를 실행하며, 언제든 할 수 있습니다. /etc/xtab은 직접 고치지 않습니다.
참고:
- 지금 내보낸 디렉터리의 부모나 하위 디렉터리이면서 같은 파일 시스템에 있는 디렉터리는 내보낼 수 없습니다.
- NFS 버전 2·3은 디렉터리와 파일을 모두 내보낼 수 있지만, NFS 버전 4 접근에는 디렉터리만 내보낼 수 있습니다.
/etc/exports에 같은 디렉터리의 버전 2(또는 3) 항목과 버전 4 항목이 따로 있으면 둘 다 내보냅니다.- 한 디렉터리의 버전 2(또는 3)와 4 옵션이 같으면
-vers=3:4를 준 항목 하나로 둘 수 있습니다.
영어 원문
The exportfs command makes local directories available for Network File System (NFS) clients to mount. This command is normally invoked during system startup by the /etc/rc.nfsfile and uses information in the /etc/exports file to export one or more directories, which must be specified with full path names.
The /etc/xtab file lists directories that are currently exported. To display this file, enter the exportfs command without flags or arguments. To alter the file or to alter the characteristics of one of its directories, root users can edit the /etc/exports file and run the exportfs command. Such alterations can be done at any time. Never edit the /etc/xtab file directly.
Note:
You cannot export a directory that is either a parent directory or a subdirectory of one that is currently exported and within the same file system.
NFS versions 2 and 3 allow both directories and files to be exported. Only directories can be exported for NFS version 4 access.
If two entries for the same directory with different versions 2 (or 3) and 4 exist in the /etc/exports file, the exportfs command exports both of the entries.
If the options for NFS versions 2 (or 3) and 4 are the same for a directory, there can be one entry in the /etc/exports file specifying
-vers=3:4.
플래그
| 플래그 | 설명 |
|---|---|
-a |
exports 파일에 있는 디렉터리를 모두 내보냅니다. |
-v |
내보내거나 거둘 때 디렉터리 이름을 출력합니다. |
-u |
지정한 디렉터리를 거둡니다. -a와 함께면 내보낸 디렉터리를 모두, -a와 -f를 함께 주면 지정한 export 파일의 디렉터리를 모두 거둡니다. |
-i |
exports 파일에 없는 디렉터리도 내보내거나, exports 파일의 옵션을 무시합니다. -f로 다른 파일을 주지 않으면 보통 /etc/exports에서 그 디렉터리의 옵션을 찾습니다. |
-f File |
/etc/exports 대신 쓸 export 파일. 형식은 /etc/exports와 같습니다. 이 파일은 시스템과 NFS를 시작할 때 자동으로 쓰이지 않으며, 부팅 때 내보낼 디렉터리는 /etc/exports에만 둘 수 있습니다. |
-F |
강제로 거둡니다. -u와 함께만 씁니다. V2/V3 내보내기에는 효과가 없고, 관련 상태 때문에 실패할 수 있는 V4 거두기에서 그 상태를 강제로 풉니다. |
-o Options |
내보낼 디렉터리의 선택 특성. 여러 개는 쉼표로 나눕니다(아래 표). |
-V Exported Version |
버전 번호. 2, 3, 4를 쓸 수 있습니다. |
Client 매개변수를 받는 옵션에서 Client는 호스트 이름, 점 10진수 IP 주소, 네트워크 이름, 서브넷 지정자입니다. 서브넷 지정자는 @host/mask 형식으로, host는 호스트 이름이나 IP 주소, mask는 접근을 검사할 때 쓸 비트 수입니다(없으면 전체). 예를 들어 @client.group.company.com/16은 company.com 서브넷의 모든 클라이언트와, /24는 group.company.com 서브넷의 클라이언트와만 맞습니다.
-o 옵션:
| 옵션 | 설명 |
|---|---|
ro |
읽기 전용으로 내보냅니다. 없으면 읽기·쓰기입니다. |
ro=Client[:Client] |
목록의 클라이언트에는 읽기 전용, 나머지에는 읽기·쓰기로 내보냅니다. 읽기·쓰기 목록과 함께 쓸 수 없습니다. |
rw |
모든 클라이언트에 읽기·쓰기로 내보냅니다. |
rw=Client[:Client] |
목록의 클라이언트에는 읽기·쓰기, 나머지에는 읽기 전용으로 내보냅니다. 읽기 전용 목록과 함께 쓸 수 없습니다. |
anon=UID |
root가 보낸 요청이면 UID를 실효 사용자 ID로 씁니다. 기본 -2. NFS 버전 2·3에서 -1로 하면 익명 접근을 막습니다. 기본으로 보안 NFS는 보안이 없는 요청을 익명으로 받으며, 더 엄격하게 하려면 -1로 정합니다. |
root=Client[:Client] |
목록의 클라이언트에 root 접근을 허락합니다. 다른 옵션의 뜻은 바뀌지 않아, root 목록에 있어도 access 목록에 없으면 마운트를 거부합니다. |
access=Client[:Client,...] |
목록의 클라이언트에만 마운트를 허락합니다. 클라이언트는 호스트 이름이나 넷그룹 이름이며, 먼저 /etc/netgroup에서, 다음에 /etc/hosts에서 찾습니다. 기본은 모든 머신이 마운트할 수 있습니다. |
secure |
클라이언트가 더 안전한 프로토콜을 쓰게 합니다. sec와 함께 쓸 수 없으며 폐기 예정이니 sec=dh를 씁니다. |
sec=flavor[:flavor...] |
내보낸 디렉터리의 파일에 접근할 때 쓸 수 있는 보안 방법 목록. 뒤따르는 옵션은 앞의 sec에 속하며, sec 묶음은 여럿 둘 수 있지만 방법마다 한 번씩만 씁니다. 묶음마다 ro, rw, root, access를 한 번 쓸 수 있고, public, anon, vers만 내보내기 전체에 적용됩니다. 한 번이라도 sec를 쓰면 모든 방법을 sec로 지정해야 하며, sec가 없으면 모든 인증 방법을 허락합니다. 값은 sys(UNIX 인증, 기본), dh(DES 인증), none(내보내기에 없는 방법으로 온 마운트 요청을 익명으로 처리), krb5(Kerberos 인증), krb5i(인증과 무결성), krb5p(인증, 무결성, 기밀성). |
vers=version[:version...] |
접근을 허락할 NFS 버전. 2, 3, 4. 2와 3은 따로 고를 수 없어 하나를 주면 둘 다 허락하고, 4는 따로 고를 수 있습니다. 기본은 2와 3입니다. |
exname=external-name |
외부 이름으로 내보냅니다. 외부 이름은 nfsroot 이름으로 시작해야 하며, NFS 버전 4 접근용 디렉터리에만 해당합니다. |
deleg={yes | no} |
이 내보내기의 파일 위임을 켜거나 끕니다. nfso로 정한 시스템 전체 설정보다 우선합니다. |
refer=rootpath@host[+host][:...] |
그 경로에 네임스페이스 위탁(referral)을 만들어 클라이언트를 다른 위치로 보냅니다. 그 경로에 위탁이 아닌 객체가 있으면 거부하고, 없으면 경로의 디렉터리와 함께 위탁 객체를 만듭니다. nfsroot에는 둘 수 없고 localhost는 호스트 이름으로 쓸 수 없습니다. 버전 4 전용이라 버전 2·3 접근을 허락하면 오류가 납니다. 거둬도 위탁 객체는 남으므로 rm으로 지웁니다. 5300-03 이후에서 쓸 수 있으며, 서버에 복제가 켜져 있어야 합니다(chnfs -R on). |
replicas=rootpath@host[+host][:...] |
내보내기 경로에 복제 위치 정보를 붙입니다. 현재 서버를 쓸 수 없을 때 NFS 버전 4 클라이언트가 그 위치로 옮겨 갑니다. 파일 시스템 전체에 적용되므로 경로가 파일 시스템의 루트여야 합니다. 버전 2·3 서버는 이 정보를 무시합니다. 내보내는 디렉터리가 목록에 없으면 디렉터리@현재호스트가 첫 위치로 들어갑니다. 서버의 복제는 기본으로 꺼져 있어 chnfs -R on으로 켜며, 복제 모드는 버전 4 내보내기가 없을 때만 바꿀 수 있고 바꾸면 이전 파일 핸들을 받아 주지 않으므로 클라이언트가 먼저 마운트를 푸는 것이 좋습니다. 목록을 고쳐 다시 내보내면 새 정보로 바뀌며, 클라이언트가 알아채도록 exportfs가 디렉터리를 touch합니다(읽기 전용이면 못 할 수 있음). |
noauto |
replicas 목록을 그대로 받고, 주 호스트 이름을 자동으로 넣지 않습니다. |
scatter={full | partial | none} |
refer·replicas의 서버로 대체 위치 목록을 만드는 방식. full은 모든 서버를 섞어 조합, partial은 첫 위치를 첫 서버로 고정하고 나머지를 섞음, none은 섞지 않음(이미 켠 것을 끌 때도 씀). NFS 버전 4 전용입니다. |
Client의 속성이 바뀌면(넷그룹을 고치거나 클라이언트 IP 주소가 바뀌면) 그 Client를 매개변수로 가진 내보내기 항목을 모두 다시 내보내야 합니다. 그러지 않으면 서버가 예전 클라이언트 정보를 씁니다.
영어 원문
-a— Exports all directories listed in the exports file.-v— Prints the name of each directory as it is exported or unexported.-u— Unexports the directories you specify. When used with the-aflag, unexports all exported directories. When used with both the-aand-fflags, unexports all directories in the specified export file.-i— Allows the exporting of directories not specified in the exports file or ignores the options in the exports file. Unless the-fflag is used to specify an alternate file, the exportfs command will normally consult the /etc/exports file for the options associated with the exported directory."-fFile — Specifies an export file, instead of the /etc/exports file, that contains a list of directories that you can export. This file should follow the same format as the /etc/exports file. NOTE: This alternate file will not be used for exporting directories automatically when the system and NFS is started. The /etc/exports file is the only file that is supported for specifying directories to export at system start.- -F — Specifies that a forced unexport should be performed. Use this flag only with the
-uflag. This flag has no effect when unexporting a V2/V3 export. A V4 unexport can fail due to associated state. This flag forces the release of any state associated with a V4 export. -oOptions — Specifies the optional characteristics for the directory being exported. You can enter more than one variable by separating them with commas. For options taking a Client parameter, Client can specify a hostname, a dotted IP address, a network name, or a subnet designator. A subnet designator is of the form "@host/mask", where host is either a hostname or a dotted IP address and mask specifies the number of bits to use when checking access. If mask is not specified, a full mask is used. For example, the designator@client.group.company.com/16will match all Clients on thecompany.comsubnet. A designator of@client.group.company.com/24will match only the Clients on thegroup.company.comsubnet. Choose from the following options: ro Exports the directory with read-only permission. If not specified, the directory is exported with read-write permission. ro=Client[:Client] Exports the directory with read-only permission to the specified Clients. Exports the directory with read-write permissions to Clients not specified in the list. A read-only list cannot be specified if a read-write list has been specified. rw Exports the directory with read-write permission to all Clients. rw=Client [:Client] Exports the directory with read-write permission to the specified Clients. Exports the directory read-only to Clients not in the list. A read-write list cannot be specified if a read-only list has been specified. anon =UID Uses the UID value as the effective user ID, if a request comes from a root user. The default value for this option is -2. In NFS version 2 and NFS version 3, setting the value of the anon option to -1 disables anonymous access. Thus, by default, secure NFS accepts nonsecure requests as anonymous, and users who want more security can disable this feature by setting anon to a value of -1. root=Client[:Client] Allows root access from the specified clients in the list. Putting a host in the root list does not override the semantics of the other options. For example, this option denies the mount access from a host present in the root list but absent in the access list. access=Client[:Client,...] Gives mount access to each client listed. A client can be either a host name or a net group name. Each client in the list is first checked for in the /etc/netgroup database and then in the /etc/hosts database. The default value allows any machine to mount the given directory. secure Requires clients to use a more secure protocol when accessing the directory.-oOptions (continued) — sec=flavor[:flavor...] This option is used to specify a list of security methods that may be used to access files under the exported directory. Most exportfs options can be clustered using the sec option. Options following a sec option are presumed to belong with the preceding sec option. Any number of sec stanzas may be specified, but each security method can be specified only once. Within each sec stanza the ro, rw, root, and access options may be specified once. Only the public, anon and vers options are considered global for the export. If the sec option is used to specify any security method, it must be used to specify all security methods. In the absence of any sec option, all authentication flavors are allowed. Allowable flavor values are: sys UNIX authentication. This is the default method. dh DES authentication. none Allow mount requests to proceed with anonymous credentials if the mount request uses an authentication flavor not specified in the export. krb5 Kerberos. Authentication only. krb5i Kerberos. Authentication and integrity. krb5p Kerberos. Authentication, integrity, and privacy. The secure option may be specified, but not in conjunction with a sec option. The secure option is deprecated and may be eliminated. Use sec=dh instead.vers=version_number[:version_number...] Specifies which versions of NFS are allowed to access the exported directory. Valid versions are 2, 3, and 4. Versions 2 and 3 cannot be selected exclusively. Specifying either version 2 or version 3 will allow access by both NFS version 2 and NFS version 3. Version 4 can be selected exclusively. The default is to allow access using NFS protocol versions 2 and 3. exname=external-name Exports the directory by the specified external name. The external name must begin with the nfsroot name. See the description of the /etc/exports file for a description of the nfsroot name. This option applies only to directories exported for access by NFS version 4 protocol. deleg={yes|no} Enables or disables file delegation for the specified export. This option overrides the system-wide delegation enablement for this export. The system-wide enablement is done through nfso.-oOptions (continued) — refer=rootpath@host[+host][:rootpath@host[+host]] A namespace referral will be created at the specified path. The referral directs clients to the specified alternate locations where they can continue operations. A referral is a special object. If a nonreferral object exists at the specified path, the export is disallowed and an error message is printed. If nothing exists at the specified path, a referral object is created there that includes the path name directories leading to the object. Multiple referrals can be created within a file system. A referral cannot be specified for the nfsroot. The namelocalhostcannot be used as a hostname. This refer option is allowed only for version 4 exports. If the export specification allows version 2 or version 3 access, an error message will be printed and the export will be disallowed. Unexporting the referral object has the effect of removing the referral locations information from the referral object. The object itself is not removed by unexporting. Use rm if you want to remove the object. The administrator must ensure that appropriate data is available at the referral servers. This option is available only on AIX 5L Version 5.3 with the 5300-03 Recommended Maintenance package or later. Note: A referral export can only be made if replication is enabled on the server. Use chnfs -R on to enable replication.-oOptions (continued) — replicas=rootpath@host[+host][:rootpath@host[+host]] Replica location information will be associated with the export path. The replica information can be used by NFS version 4 clients to redirect operations to the specified alternate locations if the current server becomes unavailable. The administrator should ensure that appropriate data is available at the replica servers. Because replica information applies to an entire file system, the specified path must be the root of a file system. If the path is not a file system root, the export is disallowed and an error message is printed. The namelocalhostcannot be used as a hostname. This replicas option is meaningful only for version 4 exports. If the option is used on an export that allows version 2 or version 3 access, the operation is allowed, but the replica information is ignored by the version 2 and version 3 servers. If the directory being exported is not in the replica list, the entry exported directory@current host will be added as the first replica location. This option is available only on AIX 5.3 with 5300-03 or later. A replica export can only be made if replication is enabled on the server. By default, replication is not enabled. If replica exports will be made at system boot, replication should be enabled by using the chnfs -R on command. Replica locations can also be specified for the nfsroot. This can be done only using chnfs -R host[+host]. If the current host is not specified in the list, it will be added as the first replica host. The rootpath is not needed or allowed in this case because nfsroot is replicated only to the nfsroots of the specified hosts. The chnfs program can be used to enable or disable replication. Changing the replication mode can only be done if no NFS version 4 exports are active. If the server's replication mode is changed, file handles issued by the server during the previous replication mode will not be honored by the server. This can cause application errors on clients holding old file handles. Be careful when changing the replication mode of the server. If possible, all clients who have mounts to the server should unmount them before the server's replication mode is changed. The replica location information associated with the directory can be changed by modifying the replica list and reexporting the directory. The new replica information replaces the old replica information. NFS clients are expected to refresh replica information on a regular basis. If the server changes the replica information for an export, it might take time for the client to notice. This is not much of a problem if new replica locations are added, because clients holding the old information still have correct, if incomplete, replica information. Removing replica information can be problematic because it can result in clients holding incorrect replica information for a period of time. To aid clients in detecting the new information, exportfs will attempt to touch the replicated directory. This changes the timestamps on the directory, which in turn causes the client to refetch the directory's attributes. This operation might not be possible, however, if the replicated file system is read-only. When changing replica information for a directory, be aware that there could be some latency between changing the information and clients noticing the new information.-oOptions (continued) — noauto Accepts the replicas specification as-is. Does not automatically insert the primary hostname as one of the replica locations if it has not been specified. scatter Defines how the alternate locations list is generated from the servers specified on the refer or replicas option. If the noauto option is not used, the alternate locations list also includes the primary host name as one of the replica locations. The scatter option applies only to directories exported for access by NFS version 4 protocol. The scatter option has three allowable values: full All of the servers are scattered to form the combinations of alternate locations. partial The first location of all the combinations is fixed to the first server specified on the refer or replicas option. The rest of the locations and the first location are scattered as if they are scattered using thescatter=fullmethod. none No scatter is to be used. The value can also be used to disable scattering if enabled previously. Whenever the attributes of a Client change, all export entries that contain that Client as a parameter should be exported again. Events that can change a Client's attributes include modifying a netgroup or changing the IP address of a client. Failure to do so can result in the server using old client information.-VExported Version — Specifies the version number. Valid version numbers are 2, 3 and 4.
Solaris Compatibility
exportfs는 share, shareall, unshare, unshareall이라는 이름으로도 실행할 수 있습니다. share와 shareall은 각각 exportfs, exportfs -a와 같지만 보안 방법을 sec 옵션으로 지정해야 합니다. unshare와 unshareall은 각각 exportfs -u, exportfs -u -a와 같습니다.
영어 원문
The exportfs command may be invoked as share, shareall, unshare, or unshareall. When the exportfs command is invoked as share or shareall, the functionality is equivalent to exportfs and exportfs -a, respectively, except that the sec option must be used to specify the security methods. When the exportfs command is invoked as unshare or unshareall, the functionality is equivalent to exportfs -u and exportfs -u -a, respectively.
보안
RBAC 사용자와 Trusted AIX 사용자는 주의하세요. 이 명령은 특권 작업을 할 수 있으며, 특권 작업은 특권 사용자만 할 수 있습니다. 특권과 권한 목록은 lssecattr 명령이나 getcmdattr 하위 명령으로 봅니다(6.1 문서에만 있음).
영어 원문
Attention RBAC users and Trusted AIX users: This command can perform privileged operations. Only privileged users can run privileged operations. For more information about authorizations and privileges, see Privileged Command Database in Security. For a list of privileges and the authorizations associated with this command, see the lssecattr command or the getcmdattr subcommand.
예제
| 명령 | 하는 일 |
|---|---|
exportfs -a |
/etc/exports의 모든 디렉터리를 내보냄 |
exportfs /home/notes |
/etc/exports에 있는 /home/notes 하나를 내보냄 |
exportfs -u /home/notes |
/home/notes를 거둠 |
exportfs -v |
내보낸 디렉터리 이름을 보여 줌 |
exportfs -i /home/zeus |
/etc/exports에 없는 /home/zeus를 제한 없이 내보냄 |
exportfs -i -o access=cowboys:oilers /home/notes |
cowboys, oilers 호스트(넷그룹)에만 접근을 허락해 내보냄 |
exportfs -i -o root=zorro:silver /directory |
/etc/exports의 권한과 상관없이 zorro, silver에 root 접근을 허락해 내보냄 |
exportfs -V 3:4 /common/docs |
버전 3과 4로 내보냄 |
exportfs -a -V 4 |
/etc/exports의 버전 4 항목을 모두 내보냄 |
exportfs -u -V 3 /common/docs |
버전 3으로만 거둠 |
exportfs -ua -V 3 |
/etc/xtab의 버전 3 항목을 모두 거둠 |
/etc/exports 항목 예(넣은 뒤 그 디렉터리를 exportfs로 내보냄):
# Kerberos 클라이언트는 쓰기, UNIX 인증 클라이언트는 읽기 전용
/common/docs -sec=krb5,rw,sec=sys,ro
# /usr/info에 infoserver의 /usr/info로 가는 위탁
/usr/info -vers=4,refer=/usr/info@infoserver
# backup1, backup2에 복제
/common/info -vers=4,replicas=/common/info@backup1:/common/info@backup2
# s1, s2, s3으로 위탁하고 모두 섞음
/common/docs -vers=4,refer=/common/docs@s1:/common/docs@s2:/common/docs@s3,scatter=full
# s1~s4에 복제하고 부분적으로 섞음(모든 조합의 첫 장애 조치 서버는 s1)
/common/docs -vers=4,noauto,replicas=/common/docs@s1:/common/docs@s2:/common/docs@s3:/common/docs@s4,scatter=partial
자주 쓰는 형태:
cat /etc/exports # /data -rw=app1:app2,root=app1,access=app1:app2
exportfs -va # 모두 내보내며 이름 출력
exportfs # 지금 내보낸 목록(/etc/xtab)
mknfsexp -d /data -t rw -r app1 -c app1,app2 -B # /etc/exports에 넣고 바로 내보냄
showmount -e localhost
영어 원문
- To export all directories in the /etc/exports file, enter:
exportfs -a
- To export one directory from the /etc/exports file, enter:
exportfs /home/notes
In this example, the /home/notes directory is exported.
Note: For this command to work, the /home/notes directory must be specified in the /etc/exports file.
- To unexport a directory, enter:
exportfs -u /home/notes
In this example, the /home/notes directory is unexported.
- To display the name of the directory currently being exported, enter:
exportfs -v
- To export a directory that is not specified in the /etc/exports file, enter:
exportfs -i /home/zeus
In this example, the /home/zeus directory is exported without restrictions.
- To export a directory and give netgroup members permission to access this directory, enter:
exportfs access=cowboys:oilers /home/notes -o
In this example, the /home/notes directory is exported and permits users of cowboys and oilers host machines to have access.
- To export a directory with different options from the /etc/exports file, enter:
exportfs -i -o root=zorro:silver /directory
In this example, the /directory directory is exported and allows root user access to zorro and silver host machines, regardless of the access permissions specified in the /etc/exports file.
- To export the /common/docs directory with write permissions to clients using Kerberos authentication, but read-only permissions to clients using UNIX authentication, add the following text to the /etc/exports file:
/common/docs -sec=krb5,rw,sec=sys,ro
Then enter exportfs /common/docs to perform the export.
- To create a referral at /usr/info to the /usr/info directory on host
infoserver, add the following line to /etc/exports and then export /usr/info:
/usr/info -vers=4,refer=/usr/info@infoserver
- To specify replicas for the /common/info directory at hosts
backup1andbackup2, add the following line to /etc/exports and then export /common/info:
/common/info -vers=4,replicas=/common/info@backup1:/common/info@backup2,<other options>
- To export the /common/docs directory with both version 3 and version 4, enter the following command:
exportfs -V 3:4 /common/docs
- To export all of the version 4 entries in the /etc/exports file, enter the following command:
exportfs -a -V 4
- To unexport the /common/docs directory only for version 3, enter the following command:
exportfs -u -V 3 /common/docs
- To unexport all of the version 3 entries in the /etc/xtab file, enter the following command:
exportfs -ua -V 3
- To specify referrals for the /common/docs directory at hosts named
s1,s2, ands3and scatter them fully, add the following line to the /etc/exports file and then export the /common/docs directory:
/common/docs -vers=4,refer=/common/docs@s1:/common/docs@s2:/common/docs@s3,scatter=full
- To specify replicas for the /common/docs directory at hosts named
s1,s2,s3, ands4and scatter them partially (the first fail over server iss1for all combinations), add the following line to the /etc/exports file and then export the /common/docs directory:
/common/docs -vers=4,noauto,replicas=/common/docs@s1:/common/docs@s2:/common/docs@s3:/common/docs@s4,scatter=partial
파일
| 파일 | 설명 |
|---|---|
/etc/exports |
서버가 내보낼 수 있는 디렉터리 |
/etc/xtab |
지금 내보낸 디렉터리 |
/etc/hosts |
네트워크의 호스트마다 한 항목 |
/etc/netgroup |
네트워크의 사용자 그룹 정보 |
/etc/rc.nfs |
NFS와 NIS 데몬 시작 스크립트 |
영어 원문
- /etc/exports — Lists the directories that the server can export.
- /etc/xtab — Lists currently exported directories.
- /etc/hosts — Contains an entry for each host on the network.
- /etc/netgroup — Contains information about each user group on the network.
- /etc/rc.nfs — Contains the startup script for the NFS and NIS daemons.
Related information:
- chnfsexp command
- mknfsexp command
- How to Export a File System Using Secure NFS
- List of NFS commands
리눅스(GNU)와 다른 점
리눅스에서도 exportfs(nfs-utils)와 /etc/exports를 쓰지만 형식이 다릅니다. 리눅스는 /data 10.1.1.0/24(rw,sync,no_root_squash) host1(ro)처럼 클라이언트마다 괄호 안에 옵션을 주고, AIX는 /data -rw=host1,root=host1처럼 옵션에 클라이언트 목록을 줍니다. AIX의 root=는 리눅스의 no_root_squash, anon=은 anonuid=에 해당합니다. 다시 읽기는 exportfs -ra, 목록은 exportfs -v입니다.