The share utility makes local file systems available for mounting by remote systems.
If no argument is specified, then share displays all file systems currently shared, including NFS file systems and file systems shared through other distributed file system packages.
Provide a comment that describes the file system to be shared.
Share NFS file system type.
Specify specific_options in a comma-separated list of keywords and attribute-value-assertions for interpretation by the file-system-type-specific command. If specific_options is not specified, then by default sharing will be read-write to all clients. specific_options can be any combination of the following:
Allows the NFS server to do access control for NFS Version 2 clients (running SunOS 2.4 or earlier). When aclok is set on the server, maximal access is given to all clients. For example, with aclok set, if anyone has read permissions, then everyone does. If aclok is not set, minimal access is given to all clients.
Set uid to be the effective user ID of unknown users. By default, unknown users are given the effective user ID UID_NOBODY. If uid is set to -1, access is denied.
Load file rather than a listing of the directory containing this file when the directory is referenced by an NFS URL.
Enables NFS server logging for the specified file system. The optional tag determines the location of the related log files. The tag is defined in etc/nfs/nfslog.conf. If no tag is specified, the default values associated with the “global” tag in etc/nfs/nfslog.conf will be used.
Prevents clients from mounting subdirectories of shared directories. For example, if /export is shared with the nosub option on server fooey then a NFS client will not be able to do:
mount -F nfs fooey:/export/home/mnt
By default, clients are allowed to create files on the shared file system with the setuid or setgid mode enabled. Specifying nosuid causes the server file system to silently ignore any attempt to enable the setuid or setgid mode bits.
Moves the location of the public file handle from root (/) to the exported directory for WebNFS-enabled browsers and clients. This option does not enable WebNFS service; WebNFS is always on. Only one file system per server may use this option. Any other option, including the -ro=list and -rw=list options can be included with the public option.
Sharing will be read-only to all clients.
Sharing will be read-only to the clients listed in access_list; overrides the rw suboption for the clients specified. See access_list below.
Only root users from the hosts specified in access_list will have root access. See access_list below. By default, no host has root access, so root users are mapped to an anonymous user ID (see the anon=uid option described above). Netgroups can be used if the file system shared is using UNIX authentication ( AUTH_SYS).
Sharing will be read-write to all clients.
Sharing will be read-write to the clients listed in access_list; overrides the ro suboption for the clients specified. See access_list below.
Sharing will use one or more of the specified security modes. The mode in the sec=mode option must be a node name supported on the client. If the sec= option is not specified, the default security mode used is AUTH_SYS. Multiple sec= options can be specified on the command line, although each mode can appear only once. The security modes are defined in nfssec(5).
Each sec= option specifies modes that apply to any subsequent window=, rw, ro, rw=, ro= and root= options that are provided before another sec=option. Each additional sec= resets the security mode context, so that more window=, rw, ro, rw=, ro= and root= options can be supplied for additional modes.
If the option sec=none is specified when the client uses AUTH_NONE, or if the client uses a security mode that is not one that the file system is shared with, then the credential of each NFS request is treated as unauthenticated. See the anon=uid option for a description of how unauthenticated requests are handled.
This option has been deprecated in favor of the sec=dh option.
When sharing with sec=dh, set the maximum life time (in seconds) of the RPC request's credential (in the authentication header) that the NFS server will allow. If a credential arrives with a life time larger than what is allowed, the NFS server will reject the request. The default value is 30000 seconds (8.3 hours).
The name of a host. With a server configured for DNS or LDAP naming in the nsswitch "hosts" entry, any hostname must be represented as a fully qualified DNS or LDAP name.
A netgroup contains a number of hostnames. With a server configured for DNS or LDAP naming in the nsswitch "hosts" entry, any hostname in a netgroup must be represented as a fully qualified DNS or LDAP name.
To use domain membership the server must use DNS or LDAP to resolve hostnames to IP addresses; that is, the "hosts" entry in the /etc/nsswitch.conf must specify "dns" or “ldap” ahead of "nis" or "nisplus", since only DNS and LDAP return the full domain name of the host. Other name services like NIS or NIS+ cannot be used to resolve hostnames on the server because when mapping an IP address to a hostname they do not return domain information. For example,
NIS or NIS+ 184.108.40.206 --> "myhost DNS or LDAP 220.127.116.11 --> "myhost.mydomain.mycompany.com"
The domain name suffix is distinguished from hostnames and netgroups by a prefixed dot. For example,
A single dot can be used to match a hostname with no suffix. For example,
will match "mydomain" but not "mydomain.mycompany.com". This feature can be used to match hosts resolved through NIS and NIS+ rather than DNS and LDAP.
The network or subnet component is preceded by an at-sign (@). It can be either a name or a dotted address. If a name, it will be converted to a dotted address by getnetbyname(3SOCKET). For example,
=@129.144 or =@18.104.22.168
=@theothernet/17 or =@129.144.132/22
A prefixed minus sign (-) denies access to that component of access_list. The list is searched sequentially until a match is found that either grants or denies access, or until the end of the list is reached. For example, if host "terra" is in the "engineering" netgroup, then
The following example shows the /export file system shared with logging enabled:
example% share -o log /export
list of system types, NFS by default
system record of shared file systems
system record of logged file systems
logging configuration file
See attributes(5) for descriptions of the following attributes:
|ATTRIBUTE TYPE||ATTRIBUTE VALUE|
If the sec= option is presented at least once, all uses of the window=, rw, ro, rw=, ro= and root= options must come after the first sec= option. If the sec= option is not presented, then sec=sys is implied.
share -F nfs /var share -F nfs -o sec=sys /var
share -F nfs -o sec=dh /var
Unlike previous implementations of share_nfs(1M), access checking for the window=, rw, ro, rw=, and ro= options is done per NFS request, instead of per mount request.
share -F nfs -o sec=dh,rw,sec=sys,rw=hosta /var
share -F nfs -o sec=dh,rw,sec=sys,ro /var
If rw=, and ro= options are specified in the same sec= clause, and a client is in both lists, the order of the two options determines the access the client gets. If client hosta is in two netgroups - group1 and group2 - in this example, the client would get read-only access:
share -F nfs -o ro=group1,rw=group2 /var
share -F nfs -o rw=group2,ro=group1 /var
If within a sec= clause, both the ro and rw= options are specified, for compatibility, the order of the options rule is not enforced. All hosts would get read-only access, with the exception to those in the read-write list. Likewise, if the ro= and rw options are specified, all hosts get read-write access with the exceptions of those in the read-only list.
The ro= and rw= options are guaranteed to work over UDP and TCP but may not work over other transport providers.
The root= option with AUTH_SYS is guaranteed to work over UDP and TCP but may not work over other transport providers.
The root= option with AUTH_DES is guaranteed to work over any transport provider.
There are no interactions between the root= option and the rw, ro, rw=, and ro= options. Putting a host in the root list does not override the semantics of the other options. The access the host gets is the same as when the root= options is absent. For example, the following share command will deny access to hostb:
share -F nfs -o ro=hosta,root=hostb /var
share -F nfs -o ro=hostb,root=hostb /var
share -F nfs -o ro=hosta,rw=hostb,root=hostb /var
If the file system being shared is a symbolic link to a valid pathname, the canonical path (the path which the symbolic link follows) will be shared. For example, if /export/foo is a symbolic link to /export/bar (/export/foo -> /export/bar), the following share command will result in /export/bar as the shared pathname (and not /export/foo).
example# share -F nfs /export/foo
share -F nfs -o ro /disk