Skip to main content
Home
The Baheyeldin Dynasty
The journey for wisdom starts with knowledge
  • Home
  • About
  • Site Map
  • Contact

Setting up autofs automount for a Linux network

  1. Home

By Khalid on 2004/09/11 - 11:38, last updated 2004/10/20 - 18:36

One of the great things about UNIX and Linux is that they were built from the start to be multitasking and multiuser operating systems.

As networking became faster, new additions were done that was also multitasking and multiuser, such as the network file system, or NFS.

The automounter is an important part of managing a UNIX network with a few users and machines to several hundreds or thousands of them.

Linux implements the automounter as autofs. It is not limited to network file systems, and can do other local devices as well, such as CD-ROMs, floppies, USB devices, and much more.

When combined with KDE's session saving feature, this becomes a very convenient setup, where any user can login anywhere, and get the same session as he last left it, with the same applications opening up as they were.

This article focuses on how to use the automounter in Linux for remote file systems.

Introduction

If you have a home network of several machines used by several people, a few issues may crop up after some time using it. For example:

  • Users will have data on their local machines. This complicates things such as backups, which are easier if they are centralized.
  • Users may want to access their data from other machines, such as a test machine in the lab, or if their own machine is down.

The answer to the above is to use the automounter to make the users' home directories available on any machine they log in to.

Assumptions

The assumption here is that you have a server that has NFS running, and that the /etc/exports file has the home directories setup to be shared.

Then you have to setup every client machine per the following steps:

Installation

To acheive this, you need to install and configure the the autofs package. If you are using an RPM based distribution, then check RPMFind for your distribution and architecture.

On Mandrake, you can use the following command:

urpmi autofs

On Debian, you can use apt-get.

Configuration

After you finish the installation, you have to configure autofs.

First, as root, you have to edit the file: /etc/auto.master to include the following line:

/home   /etc/auto.home  --timeout=60

Then, create a new file called /etc/auto.home, and add the following line in it:

*          -fstype=nfs,rw,nosuid,soft     server:/home/&

You have replace server in the above file by the hostname of your NFS server.

The secret to this working as well as it does, is the * and /home/& parts. This tells the automounter to mount user directories on demand. This setup makes things simple, and eliminates the need to list every user's home directory in the configuration file.

Then, issue the following command as :

/etc/init.d/autofs start

Conclusion

Now, any access to home directories from any client machine will cause this directory to be mounted.

Combined with KDE's session saving, this becomes a very convenient feature, since users get their exact session on any machine they login to.

My daughters use this feature to login from another machine if their own one has a problem.

Neat, isn't it?

Contents: 
Linux
  • Add comment

Comments

Anonymous (not verified)

Thank you!

Mon, 2008/03/03 - 18:25

Thank you!

  • reply

Bob (not verified)

It goes without saying...

Tue, 2008/03/11 - 08:59

One should do this as root, not as a normal user working as root (via su, sudo, etc.) and especially not as a normal user logged in via graphical console (KDE, Gnome.) Expect the desktop to freeze as it gets confused as to where your home directory went when you fire up autofs.

I found it helpful to use rsync or 'cp -a' to copy home directories to their new autohome location, then move the old home directory to someplace memorable like /home.old. Make sure your users' uids and guids line up on all your systems and move non-user home directories elsewhere. The former problem is solved with LDAP, NIS, or tedious work with vi and chown (note: I would like to talk with someone who has set up LDAP at home, assuming anyone is crazy/bored enough to have done such a thing.)

In my case, I had a Subversion repository under /home/svn - I moved it to /srv/svn and changed the Apache config (remember to reload Apache) and it worked just fine. /home/ftp moved to /srv/ftp.home - I'm not sure that even needs to exist.

When the dust settles, the three-line config change above should make your life easier or at least more consistent and save you some disk space and backup headaches. As usual, you trade one form of headache for another, but it's really nice not wondering which machine holds the file you need right now.

So beware the pitfalls - they aren't insurmountable. I just wanted to keep someone else from working along, noticing strange behavior while setting this up and wondering "Have I just hosed myself...?" just as their desktop goes dark. :)

Thanks for the excellent simple tutorial!

  • reply

Priya Chandran (not verified)

Thanks, incredibly helpful!

Mon, 2010/03/29 - 13:14

Thanks, incredibly helpful!

  • reply

Anonymous (not verified)

Soft mount?

Thu, 2010/08/26 - 18:25

These are home directories users will be writing to. They should be hard mounts, not soft!

  • reply

Joan (not verified)

users home directories in differetn places

Thu, 2010/09/09 - 10:35

Hi,

i have two different groups of users.

One of them have their home directory under /home.

The second group have their home under /srv/exports/OtherUsers

* -fstype=nfs,rw,nosuid,soft server:/home/&

works for the first group

* -fstype=nfs,rw,nosuid,soft server:/svr/exports/OtherUsers

works for the second group.

What can i do if i want that works for the two groups together.

Thanks

  • reply

kusi (not verified)

share home?

Thu, 2010/11/25 - 08:45

Is it a good idea to share the home directory among several computers? Aren't there too many machine specific settings (font size, screen resolutions) in directories under $HOME, such as .kde, .config, etc...? What are your experiences?

I decided to just share a "Documents" folder among several computers

  • reply

Current

Pandemic

  • COVID-19
  • Coronavirus

Search

Site map

Contents

  • Family
    • Khalid
    • Ancestry
    • Extended
  • Friends
  • Nokat نكت
  • Writings
    • Cooking
    • Culture
    • Science
    • History
    • Linguistics
    • Media
    • Literature
    • Politics
    • Humor
    • Terrorism
    • Business
    • Philosophy
    • Religion
    • Children
  • Technology
    • Linux
    • Arabization
    • Drupal
      • Association
    • Software
    • Internet
    • Technology in Society
    • Digital Archeology
    • NCR History
    • MidEast Internet
    • Programming
    • Saudi ISPs
    • Miscellaneous
  • Places
    • Canada
      • Weather
    • Egypt
      • Cuisine
      • Alexandria
      • E.G.C.
    • USA
    • Saudi Arabia
  • Interests
    • Astronomy
    • Fishing
    • Photography
    • Snorkeling
    • Nature
    • Photomicroscopy
  • Miscellany

In Depth

  • al-Hakim bi Amr Allah: Fatimid Caliph of Egypt الحاكم بأمر الله
  • Alexandria, Egypt
  • Arabic on the Internet
  • Articles on the history of Muslims and Arabs in the Iberian Peninsula تاريخ المسلمين و العرب في الأند
  • DIY GOTO Telescope Controller With Autoguiding and Periodic Error Correction
  • E.G.C. English Girls College in Alexandria, Egypt
  • Egyptian Cuisine, Food and Recipes مأكولات مصرية
  • George Saliba: Seeking the Origins of Modern Science?
  • Internet Scams and Fraud
  • Mistaken for an Arab or Muslim: Absurdities of being a victim in the War on Terror
  • Mistaken Identity: How some people confuse my site for others
  • One People's Terrorist Is Another People's Freedom Fighter
  • Overview of Google's Technologies
  • Photomicroscopy
  • Pseudoscience: Lots of it around ...
  • Resources for using Google Adsense with Drupal
  • Rockwood Conservation Area, Southern Ontario
  • Selected Symbolic Novels And Movies
  • Snorkeling the Red Sea near Jeddah
  • Updates and Thoughts on the Egyptian Revolution of 2011

Recent Content

Most recent articles on the site.

  • Origin Of COVID-19: Natural Spillover, Lab Leak Or Biological Weapon?
  • Kamal Salibi and the "Israel from Yemen" theory
  • How To Upgrade HomeAssistant Core In A Python Venv Using uv
  • Ancestry - Paternal Side
  • Review of Wait Water Saver For Whole House Humidifiers
more

Most Comments

Most commented on articles ...

  • Another scam via Craigslist: offering more than asking price
  • Warning to female tourists thinking of marrying Egyptians
  • Craigslist classified for used car: Cheque fraud scam
  • Winning the lottery scam email: World Cup South African lottery
  • Email Scam: BMW 5 Series car and lottery winning
more

About Khalid

Various little bits of information ...

  • Khalid Baheyeldin: brief biography
  • Presentations and Talks
  • Youtube Videos
  • GitHub Projects
  • Drupal.org Profile
  • Astrophotography @ Flickr

Sponsored Links

Your Link Ad Here

Tags

Android Mobile Ubuntu Sony OnStep OpenWRT Router Ericsson COVID-19 Rogers Coronavirus Arabic Kubuntu Home Assistant GSM Telescope tablet Spectrum Scam Python 419 Laptop Firefox DIY CPU Conspiracy Comet Balkanization backup App
More

© Copyright 1999-2025 The Baheyeldin Dynasty. All rights reserved.
You can use our content under the Terms of Use.
Please read our privacy policy before you post any information on this site.
All posted articles and comments are copyright by their owner, and reflect their own views and opinions, which may not necessarily be consistent with the views and opinions of the owners of The Baheyeldin Dynasty.

Web site developed by 2bits.com Inc.