How To Create /home on a Network Drive
Wolfgang S. Rupprecht
wolfgang.rupprecht+gnus200905 at gmail.com
Sun May 10 16:58:37 UTC 2009
Anthony Messina <amessina at messinet.com> writes:
> how does one use their linux laptop like some of the coporate folks
> use their windows laptops? when they're at the office, they use the
> profile on the server; when they're away, they use the "roaming" copy
> of the profile.
Here is how I do it:
Append this to the end of /etc/sysconfig/autofs after tweaking the IP
addresses and server name to your setup.
#!/bin/sh
###############################################################################
## ##
## File: autofs-away ##
## Author: Wolfgang S. Rupprecht <wolfgang at wsrcc.com> ##
## Created: Sun Oct 5 15:00:55 PDT 2008 ##
## Contents: autofs automatic switch from using NFS-ed /home to linked ##
## ##
## Copyright (c) 2008 Wolfgang S. Rupprecht. ##
## All rights reserved. ##
## ##
## $Id$ ##
###############################################################################
# attempt #1 was to use fallback mounts in /etc/autofs.home as such. This
# caused a very long timeout till the first mount.
# aaron -fstype=nfs4,hard,intr,nodev,nosuid arbol.wsrcc.com(1),(10):/u/&
# The second try was to force a choice at boot time via a server name
# set as a variable variable
# append this file to the end of /etc/sysconfig/autofs
HOMENET="192.83.197."
# HOMENET="1.2.3."
HOMESERVER="arbol.wsrcc.com"
# HOMESERVER="192.83.197.1"
if $(ifconfig | grep --quiet $HOMENET)
then
# echo "Configuring autofs for home."
echo -n "(home) "
OPTIONS+="-DHOMESERVER=$HOMESERVER"
else
# echo "Configuring autofs for away."
echo -n "(away) "
#OPTIONS+="-DHOMESERVER=localhost /etc/auto.master-away"
OPTIONS+="-DHOMESERVER=localhost"
fi
#
# end
#
Then create /etc/auto.home:
# HOMESERVER is defined in /etc/sysconfig/autofs via a "-Dvar=val"
# define. it is switched at runtime when the starup script notices
# that we aren't on the home net.
wolfgang -fstype=nfs4,hard,intr,nodev,nosuid $HOMESERVER:/u/&
user2 -fstype=nfs4,hard,intr,nodev,nosuid $HOMESERVER:/u/&
user3 -fstype=nfs4,hard,intr,nodev,nosuid $HOMESERVER:/u/&
#
# end
#
And then reference this file in /etc/auto.master:
#
# for wsrcc homes: uncomment
#
/home /etc/auto.home
#
# end wsrcc
#
Now when the machine is booted at home it uses the home directory on the
server (located at /u/wolfgang) and when booted off-line will use the
local copy of /u/wolfgang. I periodically merge the laptop and server
versions of things by hand.
This auto.master has other stuff that needs to be snipped out while on
the road one can also have a pared down version of that (as the comment
in /etc/sysconfig/autofs indicates.
-wolfgang
--
Wolfgang S. Rupprecht http://www.full-steam.org/ (ipv6-only)
You may need to config 6to4 to see the above pages.
More information about the fedora-list
mailing list