LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 07-25-2013, 01:47 AM   #1
Meson
Member
 
Registered: Oct 2007
Distribution: Arch x86_64
Posts: 606

Rep: Reputation: 67
autofs for /home/<u>/<username> scheme


I'm trying to set up autofs for nfs home dirs. The scheme is /home/<u>/<username>. The only way I can figure out how to do this is with a file for every letter of the alphabet.

Code:
#auto.master
/home/a  /etc/auto.home-a
/home/b  /etc/auto.home-b
/home/c  /etc/auto.home-c
Code:
#auto.home-a
* -fstype=nfs4 server:/a/&
Surely there is a way to do this with only auto.master and auto.home (2 files). However, the wildcard doesn't seem to match anything more than a single directory.

What am I missing?
 
Old 07-26-2013, 12:16 AM   #2
Z038
Member
 
Registered: Jan 2006
Location: Dallas
Distribution: Slackware
Posts: 910

Rep: Reputation: 174Reputation: 174
I wonder if something like this would work? I haven't tried it.

Code:
#auto.master
/home    /etc/auto.home
Code:
#auto.home
*     -fstype=autofs,-Dsubdir=&   /etc/auto.subdir
Code:
#auto.subdir
*     -fstype=nfs4   server:/${subdir}/&
 
Old 07-26-2013, 07:14 AM   #3
Meson
Member
 
Registered: Oct 2007
Distribution: Arch x86_64
Posts: 606

Original Poster
Rep: Reputation: 67
Nice idea. It didn't work, but it is a different direction to play around with. Thanks!
 
Old 07-26-2013, 10:39 AM   #4
Z038
Member
 
Registered: Jan 2006
Location: Dallas
Distribution: Slackware
Posts: 910

Rep: Reputation: 174Reputation: 174
You might also try playing with executable maps. If you mark a map file executable, it can be a shell script or a binary. The big problem is that the only value passed to an executable map as an argument is the key value, and that's not enough information if you're trying to cover all the possible mount points and exports with two or three maps. You'd still need to have access to a variable like $subdir to identify the subdirectory under /home.
 
Old 07-29-2013, 11:19 PM   #5
Meson
Member
 
Registered: Oct 2007
Distribution: Arch x86_64
Posts: 606

Original Poster
Rep: Reputation: 67
The problem with executable maps is that they receive the "key" which is only a single directory, ie doesn't contain slashes. And the key is coming up as the highest level directory -- "u" -- not the lowest level -- "user".

In the meantime I have an auto.master with 26 lines (a-z) and 26 auto.home-'s (a-z).
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
autofs - mount a directory inside /home/username/ grahamb314 Linux - Software 4 07-08-2013 07:43 AM
I made a mistake changing my /home/username/pubIic_html/ ownership to username:user Sionek2u Linux - Newbie 5 06-20-2012 10:30 AM
[SOLVED] vsftpd chrooting users that have been jailed into /home/jail/home/$username. amonamarth Linux - Server 4 07-09-2011 06:29 PM
RHEL4 autofs on /home onthefritz Linux - Server 4 04-13-2010 12:10 PM
NIS and autofs with /home Rekna Linux - Networking 1 06-20-2004 11:34 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 06:55 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration