Sometimes one may need to export nfs share with a user permissions
e.g. anyone mounting nfs share has the r-w permissions and created
files have the ownership of a defined user.
Here it's a method which gives two things.
a). Provide nfs share mountable with a particular user rights.
b). Your multiple linux servers can be mapped onto a windows machine.
Problem:
Problem one may face that the windows SFU has no such option for
mapping users from two or more linux server using passwd & group files.
With the following method one can map nfs shares exported by multiple
linux servers on a windows client.
Solution:
We can configure our exports file in such a way that all linux servers
use same uid/gid for the exported files.
To map multiple nfs servers on windows client.
Operating systems I used:
1. Windows server 2003 (client)
2. RedHat Enterprise Linux 4
Software Used:
1. Microsoft Windows Services for UNIX 3.5
2. nfs-utils-1.0.6-46
NFS Server A ip address 10.1.10.3
NFS Server B ip address 10.1.10.2
Windows client settings :
Using Password and Group files option with SFU version 3.5.
The only thing required at windows client is to change the IP address
e.g. after mapping Server A with Drive letter X, follow the same
procedure for Server B (Change IP address accordingly).
NFS server nodes.
Directory exported over nfs is
/nfs3
Server A (10.1.10.3):
User name =applica
uid=510(applica) gid=510(applica) groups=510(applica)
nfs configuration:
File /etc/exports
/nfs3 *(rw,sync,all_squash,anonuid=510,anongid=510)
Permission of nfs export directory is:
chown -R applica.applica /nfs3
ls -l / |grep nfs3
drwxr-xr-x 4 applica applica 4096 Feb 1 13:30 nfs3
Server B (10.1.10.2):
uid=510(applica) gid=510(applica) groups=510(applica)
nfs configuration:
File /etc/exports
/nfs3 *(rw,sync,all_squash,anonuid=510,anongid=510)
Permissions of nfs export directory is:
drwxr-xr-x 4 applica applica 4096 Feb 1 13:49 nfs3
On linux servers check if portmap service is running if not then
start, by default portmap service is on.
/etc/init.d/portmap status OR service portmap status
start nfs service
/etc/init.d/nfs start
Set it to start automatically at boot time.
chkconfig nfs on
Please Note:
In the /etc/exports we used * which denotes world permission.
Do not use this, instead give explicit permission by changing * to the
IP address of clients.
When client mounts he will have rw permission of user with the uid/gid
mentioned in /etc/exports file. (Desired)
Mounting nfs over windows has a different method, one need to install
SFU which is available free on M$ site.
SFU needs ntfs partition.
I am not mentioning much about SFU M$. But it's simple.
Use winscp to copy /etc/passwd and /etc/group file. In settings (while
installation) select to use passwd and group files (Other option is NIS).
In case of problem, you are free to ask.
Anuj Singh.