1834285 Members
2986 Online
110066 Solutions
New Discussion

Re: Mount directory

 
ivychung2
Frequent Advisor

Mount directory

I want to export a path from host A to let host B to mount , if I want ONLY USER at host B can write file to it , I try to set the /etc/exports at host A as "/path_to_share host B(rw)" , and set the dir mode to 777 for /path_to_share ( if not set to 777 , even root can't write to it ) , now all user at host B can write sth to it , could suggest how to set it ? thx
3 REPLIES 3
ivychung2
Frequent Advisor

Re: Mount directory

sorry , sth need to correct ,

I want ONLY "ROOT" USER at host B can write file to it ,

thx
Paul Cross_1
Respected Contributor

Re: Mount directory

By default, NFS doesn't allow root on system A to be root on system B so root on the client is mapped by default to nobody. Makes sense right? In order for only root to access the NFS share, the FS must be exported with the no_root_squash option.

Example /etc/exports:
/share safehost(rw,no_root_squash)

To allow only root:
#chown root;chmod 700 /share
Muthukumar_5
Honored Contributor

Re: Mount directory

Just do this,

-- /etc/exports ---
/path_to_share hostB(rw,no_root_squash)

where,

no_root_squash:

Will not match uid/gid 0 to anonymous user. It is needed.

Change ownership of directory as,

# chmod 755 /path_to_share

Others can read or browse but not write.

--
Muthu

Easy to suggest when don't know about the problem!