• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 275
  • Last Modified:

Autofs

I would like to setup autofs and wondering how its should be implemented. I am bit confused with NFS and AutoFS. Do i need to have NFS to use autofs? how it works?
please also provide me sample configuration as well. I have one server and client which i want to test the result with.
0
ittechlab
Asked:
ittechlab
  • 3
  • 3
1 Solution
 
ittechlabLinux SupportAuthor Commented:
is AutoFS runs on client side always?
0
 
Daniel HelgenbergerCommented:
Hello,

NFS and AutoFS are two different things: NFS is a special network file system with client/server infrastructure while AutoFS is a client site service for mounting various file systems on runtime access of the mount point.
For instance, lets say you want to mount nfs shares in the /mynfs directory. While you can put an entry in /etc/fstab, this would only be executed at boot time, the server needs to be available at this time, rendering it inaccessible for the client.
As you can imagine, AutoFS is much more robust and therefore always desirable.  

AutoFS consists of several config files. The /etc/auto.master usually defining all the configs you want to load. A sample config could look like this:
$ cat /etc/auto.master
/mynfs      /etc/auto.nfsshares

Open in new window


$ cat /etc/auto.nfsshares
server1   server:/share1
server2   server:/share1
server3   server:/share1

Open in new window


Note, directories server1, server2, server3 would be created in /mynfs of your client.

The above configuration example is very basic, working for < NFSv4. There are countless supported file systems as well as numerous options for more complex needs (like auto - dismount)
0
 
ittechlabLinux SupportAuthor Commented:
what is the +auto.master in /etc/auto.master mean?
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
Daniel HelgenbergerCommented:
It just means that any maps defined in auto.master will also be included.
0
 
ittechlabLinux SupportAuthor Commented:
[root@server- lvm]# cat /etc/exports
/app/db/data *(rw)

[root@client ~]# cat /etc/auto.master  | grep -v ^#
/misc   /etc/auto.misc
/net    -hosts
+auto.master
/app/db /etc/auto.db

[root@client~]# cat /etc/auto.db
data    IP:/app/db/data

If I login to client as a user and go to /app/db/data, I am not able to write any file.  What should be done to fix the permission issue?

Also on the client side i have another local mount called /app. Will this impact with the above configuration?
0
 
Daniel HelgenbergerCommented:
If I login to client as a user and go to /app/db/data, I am not able to write any file.  What should be done to fix the permission issue?

This is an NFS issue, you should check the /etc/exports of the server and the mount options. Also, NFS permissions are determined by UNIX/POSIX GID/UID of the user trying to access the share. Make sure the groups GID numbers are consistent on both systems.

For instance, if the writable group for the exported share on the server is called nfsusers and has GID 10001, there has to be a group with GID 10001 (called to your liking) on the client and the user accessing the export needs to be a member of that group.
On the server:
groupadd -g 10001 nfsusers
chown -R root:nfsusers /myexports/share1
chmod -R g+w /myexports/share1 

Open in new window

On the client:
groupadd -g 10001 localnfs
usermod -a -G localnfs myuser

Open in new window

Afterwards myuser should be able to write on the mounted NFS share.
A quick but unsafe workaround would be to chmod -R 777 the export on the server.

Also on the client side i have another local mount called /app. Will this impact with the above configuration?
As long as you use autofs on the folder /app/db like in your config above, there will be a problem if the mount on top is not mounted for some reason because the /app/db directory does not exist.
Note, you cannot use mount points below /app/db/ other than autofs.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now