On Fri, 17 Mar 2023 17:14:03 -0300, Jim Diamond wrote:
> I was really hoping the guy who talked about his many systems (some
> clean installs, some upgrades) would chime in. But so far, no luck.
I have many systems, but I don't think I am that guy as all my systems
are clean installs (with patches and some extra packages applied).
On my 14.2 systems and earlier /etc/mtab is a file.
On my 15.0 system /etc/mtab is a symbolic link.
I have not had the need to umount nfs as a normal user as I make /etc/
rc.d/rc.autofs executable on my systems and instead access nfs exports
by /net/<the_other_host_name>.
I think the above is the default behavior with the automounter running,
but I have made some customizations to /etc/auto.master so I can't say
for sure. In my /etc/auto.master there is a line:
/net /etc/
auto.net
I am rather sure that /etc/
auto.net has not been modified by me, but this
is what it looks like:
-8<-------------------------
#
# Sample auto.master file
# This is an automounter map and it has the following format
# key [ -mount-options-separated-by-comma ] location
# For details of the format look at autofs(5).
#
#/misc /etc/auto.misc
#
# NOTE: mounts done from a hosts map will be mounted with the
# "nosuid" and "nodev" options unless the "suid" and "dev"
# options are explicitly given.
#
#/net -hosts
# -hosts does no longer work with autofs 5.0.8
/net /etc/
auto.net
#
# Include /etc/auto.master.d/*.autofs
#
+dir:/etc/auto.master.d
#
# Include central master map if it can be found using
# nsswitch sources.
#
# Note that if there are entries for /net or /misc (as
# above) in the included master map any keys that are the
# same will not be seen as the first read key seen takes
# precedence.
#
+auto.master.slack150
bash-5.1$ ls /etc/auto.master.d/
bash-5.1$ md5sum /etc/
auto.net
9113a0a4baccab3bf5cc9a476476d9c6 /etc/
auto.net
bash-5.1$ cat /etc/
auto.net
#!/bin/bash
# This file must be executable to work! chmod 755!
# Look at what a host is exporting to determine what we can mount.
# This is very simple, but it appears to work surprisingly well
key="$1"
# add "nosymlink" here if you want to suppress symlinking local
filesystems
# add "nonstrict" to make it OK for some filesystems to not mount
opts="-fstype=nfs,hard,nodev,nosuid"
for P in /bin /sbin /usr/bin /usr/sbin
do
for M in showmount kshowmount
do
if [ -x $P/$M ]
then
SMNT=$P/$M
break 2
fi
done
done
[ -x $SMNT ] || exit 1
# Newer distributions get this right
SHOWMOUNT="$SMNT --no-headers -e $key"
$SHOWMOUNT | LC_ALL=C cut -d' ' -f1 | LC_ALL=C sort -u | \
awk -v key="$key" -v opts="$opts" -- '
BEGIN { ORS=""; first=1 }
{ if (first) { print opts; first=0 }; print " \\\n\t" $1,
key ":" $1 }
END { if (!first) print "\n"; else exit 1 }
' | sed 's/#/\\#/g'
-8<-------------------------
Whenever someone or something tries to cd to /net/the_other_hostname the
automounter calls the above executable script which uses showmount to see
what that host exports by NFS and the automounter mounts those
directories. When the directories are no longer in use the aoutmounter
will umount them after some time.
regards Henrik