Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 6 Dec 2002 12:17:41 +1030 
From:      "Thyer, Matthew" <Matthew.Thyer@dsto.defence.gov.au>
To:        "'larse@isi.edu'" <larse@isi.edu>
Cc:        "'freebsd-hackers@freebsd.org'" <freebsd-hackers@freebsd.org>
Subject:   Re: Automount from a Solaris NIS/NFS server?
Message-ID:  <108E7D907871D6118B5000306E0189F8575A29@ednex504.dsto.defence.gov.au>

next in thread | raw e-mail | index | archive | help
> Tiarnan O'Corrain wrote:
>
> > I'm running FreeBSD 4.7-STABLE and have managed
> > (after some difficulty), to get it to bind to a Solaris
> > NIS server we have here. All NIS users can log on
> > now, but I can't figure out how to get home
> > directories automounted when users do log in.
> >
> > I tried a couple of things on the web, an awk
> > script to transform the Solaris "auto.home", to
> > amd syntax, and it seems to work fine, except that
> > no home directories are mounted when NIS users
> > log in.
>
> We use the script approach at ISI
> (http://www.isi.edu/larse/etc/rc.d/isiconfig), and it works fine.
> Hoperfully the script will give you some ideas that'll apply to your
> configuration.
>
> Lars
> -- 
> Lars Eggert <larse@isi.edu>           USC Information Sciences Institute.

My docs on doing this (dont abuse my awk!! - it only has to run once a day!):

The BSD automounter "AMD" can use NIS tables.
However the table format is different from the more commonly used automounter "autofs".

My example below is to automount home directories as per auto_home with "autofs".
The example assumes the server "svr" is a NIS+ server in NIS compatibility.

In order to use "AMD" for this purpose, translation of auto_home into the "AMD" format is required.

To do this translation:

1) Create a new NIS+ table on the NIS+ server with format as follows:

svr: {1017} niscat -o amd_home.org_dir
Object Name   : "amd_home"
Directory     : "org_dir.unix.dsto."
Owner         : "svr.unix.dsto."
Group         : "admin.unix.dsto."
Access Rights : r---rmcdrmcdr---
Time to Live  : 12:0:0
Creation Time : Thu Sep 26 14:32:32 2002
Mod. Time     : Thu Sep 26 14:32:32 2002
Object Type   : TABLE
Table Type          : key-value
Number of Columns   : 2
Character Separator :  
Search Path         :
Columns             :
        [0]     Name          : key
                Attributes    : (SEARCHABLE, TEXTUAL DATA, CASE SENSITIVE)
                Access Rights : ----------------
        [1]     Name          : value
                Attributes    : (TEXTUAL DATA)
                Access Rights : ----------------

2) Create a translation script on the NIS+ server with content as follows (in this example the script is "/export/data/cis/nisplus/server-setup/generate_amd_home.sh":

#!/bin/sh
temp_file=/tmp/temp_file$$
/usr/bin/niscat auto_home.org_dir | awk '{split($2,a,":"); str=""; x=1; while (x<=length(a[2])) {y=substr(a[2],x,1); if(y=="&") {str=str $1} else {str=str y}; x=x+1}; print $1,"host=="a[1]";type:=link;fs:="str" || rhost:="a[1]";type:=nfs;rfs:="str";sublink:=."}' >$temp_file
/usr/lib/nis/nisaddent -r -f $temp_file -t amd_home.org_dir.unix.dsto. key-value
rm $temp_file

3) Ensure the translation script runs once a day by creating a root cron job as follows:

# Generate amd_home.org_dir from auto_home.org_dir for users of AMD
15 4 * * * [ -x /export/data/cis/nisplus/server-setup/generate_amd_home.sh ] && /export/data/cis/nisplus/server-setup/generate_amd_home.sh


A 'more correct' approach would be to use the script feature of Solstice so that when new users are added the amd_home table gets updated.

With the above approach, new users cannot log onto "AMD" utilising clients until after 4:15am the next day.


Configuration for "AMD" on the client machines is as follows (this example for a FreeBSD client):

1) Start with the commandline:

amd -F /etc/amd.conf    (This is the default location of the config file so just "amd" will do)

2) Create /etc/amd.conf with content as follows:

[global]
map_options = opts:=intr,rsize=8192,wsize=8192
mount_type = nfs
auto_dir = /.tmp_mnt
cache_duration = 300
log_file = syslog
restart_mounts = yes
unmount_on_exit = no

[/net]
map_name = /etc/amd.map

[/home]
map_name = amd.home
map_type = nis

3) Create /etc/amd.map with content as follows:

/defaults       type:=host;fs:=${autodir}/${rhost}/host;rhost:=${key}
*               opts:=rw,grpid,resvport,vers=3,proto=udp,nosuid,nodev


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?108E7D907871D6118B5000306E0189F8575A29>