# NFS exports



## gkontos (Nov 25, 2012)

Hi all,

I have been stacked for 4 hours now in this puzzling weird issue so I appreciate any help.

/etc/exports:


```
V4: / -network 10.49.0.0 -mask 255.255.255.0
/usr/home/user1 -alldirs -mapall=user1 -network 10.49.0.0 -mask 255.255.255.0
/usr/home/user2 -alldirs -mapall=user2 -network 10.49.0.0 -mask 255.255.255.0
/usr/home/user3 -alldirs -mapall=user3 -network 10.49.0.0 -mask 255.255.255.0
...
```


```
Nov 25 18:28:45 psf00002 mountd[1102]: can't change attributes for /usr/home/user2
Nov 25 18:28:45 psf00002 mountd[1102]: bad exports list line /usr/home/user2 -alldirs -mapall
Nov 25 18:28:45 psf00002 mountd[1102]: can't change attributes for /usr/home/user3
Nov 25 18:28:45 psf00002 mountd[1102]: bad exports list line /usr/home/user3 -alldirs -mapall
```

Notice that the system does not complain for *user1*

Now, if I change the order in /etc/exports the first line always works!

What am I doing wrong?


----------



## cpm@ (Nov 25, 2012)

You can only have one line that modifies a file system for a host...
Configure your /etc/exports like:

```
V4: / -network 10.49.0.0 -mask 255.255.255.0
/usr/home/user1 /usr/home/user2 /usr/home/user3 -alldirs -mapall=root -network 10.49.0.0 -mask 255.255.255.0
```


----------



## gkontos (Nov 25, 2012)

I have tried that already without success. It still complains with "bad exports... " 

It seems to work with this configuration:


```
V4: / -network 10.49.0.0 -mask 255.255.255.0
/usr/home -alldirs -mapall=[B]root[/B] -network 10.49.0.0 -mask 255.255.255.0
```


----------



## sa (Nov 26, 2012)

According to the exports(5) manual page if a line has the -alldirs option, then this line specifies export settings for the root of the file system. This option allows to specify that this is a file system export, does not matter whether it is mounted right now or will be mounted in future. Additionally the -alldirs option administratively exports all subdirectories under specified mount point pathname for NFSv2/3 clients.

More than 5 years ago mountd was modified and now it incorrectly understands this option. There is PR bin/170413 with corrections for the -alldirs option's handling.

Can you explain what exactly do you want to configure in your example?


----------



## gkontos (Nov 26, 2012)

sa said:
			
		

> Can you explain what exactly do you want to configure in your example?



Export the user home directories of an LDAP samba server using NFSv4. 

I have tried many combinations. Even your suggestion has been tried but it seems that mountd complains no matter what the syntax / export / options are after the first line.

I managed to solve the problem as described above but I am just curious as to why this happens.


----------



## sa (Nov 26, 2012)

The entire file system is exported, administrative subdirectories exports work only for NFSv2/3 clients that use the MOUNT protocol. When one specifies some settings to subdirectory in some file system, then these settings really are specified for the entire file system. Since mountd ignores the semantics of the -alldirs option, it assumes that the given pathname with -alldirs can be a subdirectory of some file system, not a mount point. Your example has three pathnames, according to exports(5) rules they should be exported only if they are mount points. But since exports(5) rules are violated and since I guess these pathnames are subdirectories of /usr/home or /usr mount point, then all exports settings are applied to one file system and this will not work because different export settings are given for the same address specification (given in the -network option).

If you want to verify my description, then create /etc/exports with one single line "/cdrom -alldirs" (this is from EXAMPLE of exports(5)) and try to mount server:/ (the root of the file system, it is assumed that /cdrom is not a mount point).


----------



## sa (Nov 27, 2012)

cpu82 said:
			
		

> You can only have one line that modifies a file system for a host...
> Configure your /etc/exports like:
> 
> ```
> ...


This configuration does not correspond to the exports(5) rules, only a single pathname in a line can be used with the -alldirs option. But you are correct about one line for a file system for one address specification, since all address specifications with their settings are specified for file systems.


----------



## cpm@ (Nov 27, 2012)

sa said:
			
		

> This configuration does not correspond to the exports(5) rules, only a single pathname in a line can be used with the -alldirs option. But you are correct about one line for a file system for one address specification, since all address specifications with their settings are specified for file systems.



After reading it, I noticed for this detail, you found the explanation of the problem. 

Thanks for the correction.


----------

