Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In Linux, is there a way to automatically mount different network filers depending on depending on the network profile?

I have a laptop that moves from place to place and would like to mount or not mount different drives depending on where I am. Each location has a different network profile. If I'm at home DHCP would hand me an IP that's in my home range either on WiFi or ethernet. If I'm at work, DHCP would give me a another range. Depending on the network's profile, I want to mount different filers.

Is there something that already exists that accomplishes this?

share|improve this question
I essentially want Marco Polo for Linux and am too lazy to write it myself. – user11427 Sep 17 '09 at 7:53

As far as I see the only solution is to make your own start-up script which will mount whatever you need depending on your network settings.

share|improve this answer
It's not even a long script - maybe a half dozen lines in bash? – warren Sep 18 '09 at 10:10

This one-liner gives you a list of IP addresses currently in use on your machine; use that in a script to determine your location and run mounts as needed:

$ ifconfig | grep inet | awk '{print $2}' | sed s/addr://
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.