How to prevent autofs from mounting over specific directories

autofsautomount

I have a workstation, on which I have a local user account with a local home directory.
I'm also a part of an organization, in which I have a NIS user/home directory.
I would like to setup autofs in order to access some shared NFS directories.

The problem is, that after I do that, it automounts over my local home directory when I try to access it, which is not desirable for me.

Is there a way to prevent autofs from mounting to this mountpoint?

In a more general manner, is there a way to prevent autofs from mounting over existing directories?

Thanks

Best Answer

You may be able to add something like

foo      /-

to /etc/auto_home to prevent /home/foo from being mounted over the network. Make sure it comes before the +auto_home line (which asks Directory Services for mappings), so it will take precedence.

If that doesn't work, the only way to do it is to move your actual home directory somewhere else (by convention, /export/home) and configure auto_home to "mount" it from there.