Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Automounter

1 view
Skip to first unread message

Radomir Zoltowski

unread,
Mar 26, 2001, 1:25:41 PM3/26/01
to
Hi,

Could you lads give me a hand with setting up FreeBSD 4.0 NIS/NFS client
with Sun Solaris NIS/NFS 2.6 server?

I have faced a problem with automounter. I CAN mount any FS from any Sun
machine, but no FS is mounted automatically. Also I can't log in to
FreeBSD with NIS user and password. However I CAN perform su!.

I have already followed all the steps from Handbook, but it looks like I
need some more sophisticated documents to read...

Thanks in advance,

R.
--
____________________________________________________________________

Radomir Zoltowski <Radomir....@s3group.com>

Silicon & Software Systems - Information Office
South County Business Park, Leopardstown
Dublin 18, IRELAND
Tel: +353-1-207 8929, Fax: +353-1-207 8801
http://www.s3group.com/


Lars Josephsen

unread,
Mar 27, 2001, 10:29:04 AM3/27/01
to
Radomir Zoltowski <Radomir....@s3group.com> writes:

> Could you lads give me a hand with setting up FreeBSD 4.0 NIS/NFS client
> with Sun Solaris NIS/NFS 2.6 server?
>
> I have faced a problem with automounter. I CAN mount any FS from any Sun
> machine, but no FS is mounted automatically. Also I can't log in to
> FreeBSD with NIS user and password. However I CAN perform su!.

I think your problem is that your Solaris system uses a different
automounter from FreeBSD. Solaris uses autofs, like Linux, while
FreeBSD uses the AutoMount Daemon (AMD).

Autofs automount maps are not compatible with AMD, and vice versa.

Theoretically, you should be able to compile and run AMD on Solaris.
If you can't, or won't, do that, you are out of luck.

This is the reason why I only use BSDs for servers, and not
workstations.

Sincerely,

Lars Josephsen
--
Do not reply to this address!
To find my real address try a search for my name on Google.

Helmut Kreft

unread,
Mar 27, 2001, 12:05:42 PM3/27/01
to
On 27 Mar 2001 17:29:04 +0200, Lars Josephsen wrote:
>Radomir Zoltowski <Radomir....@s3group.com> writes:
>
>> Could you lads give me a hand with setting up FreeBSD 4.0 NIS/NFS client
>> with Sun Solaris NIS/NFS 2.6 server?
>>
>> I have faced a problem with automounter. I CAN mount any FS from any Sun
>> machine, but no FS is mounted automatically. Also I can't log in to
>> FreeBSD with NIS user and password. However I CAN perform su!.
>
>I think your problem is that your Solaris system uses a different
>automounter from FreeBSD. Solaris uses autofs, like Linux, while
>FreeBSD uses the AutoMount Daemon (AMD).
>

This is correct.

>Autofs automount maps are not compatible with AMD, and vice versa.
>
>Theoretically, you should be able to compile and run AMD on Solaris.
>If you can't, or won't, do that, you are out of luck.
>

You might as well write the propper maps and let them serve by
NIS. Like amd.master (and friends) in addition to auto.master (and
friends).

This might not work as I figure:
Example from my rc.conf (a Sun is NIS-Master serving autofs and amd
maps...).
# Automounter
amd_enable="YES"
amd_flags="-c 1800 -k i386 -l syslog"
amd_map_program="ypcat -k amd.master"

Since the amd_map_program could be anything - you *might* try to
get an on the fly conversion with some script and ypcat -k auto.master...

>This is the reason why I only use BSDs for servers, and not
>workstations.
>

Uhhh? In case you did not notice: Sun builds servers (and work-
stations...)
Try to replace a typical E450 server with PC Hardware. Good
luck... (and this is really a small server...)

Helmut

--
Un*x is user friendly. It's just selective about who its friends are.
kr...@ai-lab.fh-furtwangen.de

Nicolas Kowalski

unread,
Mar 28, 2001, 3:23:58 AM3/28/01
to
>>>>> "Radomir" == Radomir Zoltowski <Radomir....@s3group.com> writes:

Radomir> Hi, Could you lads give me a hand with setting up FreeBSD
Radomir> 4.0 NIS/NFS client with Sun Solaris NIS/NFS 2.6 server?

Radomir> I have faced a problem with automounter. I CAN mount any
Radomir> FS from any Sun machine, but no FS is mounted
Radomir> automatically. Also I can't log in to FreeBSD with NIS
Radomir> user and password. However I CAN perform su!.

Hello.

If you want to `su' from a NIS user, you have to make him/her a member
of the local group `wheel'.

For the NFS automounter, I have modified my NIS Makefile on the
Solaris (2.7) master server so that it generates AMD NIS maps using
AUTOFS maps through this little perl script I found some months ago,
called `/sbin/sun2amd'

[BEGIN]
#!/usr/local/bin/perl

printf "# generated by sun2amd\n";
printf "/defaults\ttype:=nfs;fs:=\${autodir}/\${path}\n";

# loop through map
while (<>) {
if (m,^([\w\*]\S*)(\s+\-\w\S*\s+|\s+)(\w[^:]*):(\/\S*)\s*(.*),) {
($dir, $options, $machine, $path, $rest) = ($1, $2, $3, $4, $5);
print "#$rest\n" if ($rest =~ m/\w/);
if ($options =~ m/-/) {
$options =~ s/ //g;
print "## options: $options\n";
$has_options++;
}
$path =~ s/\&/\$\{key\}/g;
print "$dir\trhost:=$machine;rfs:=$path\n";
}
}
[END]

Here is a sample from the Makefile :

...
all: passwd group hosts ethers networks rpc services protocols \
netgroup bootparams publickey netid netmasks c2secure \
timezone auto.master auto.home auto.import auto.direct \
amd.home amd.import \
...
$(DIR)/amd_home : $(DIR)/auto_home
/sbin/sun2amd < $(DIR)/auto_home > $(DIR)/amd_home

amd.home.time : $(DIR)/amd_home
@sed -e "/^#/d" -e s/#.*$$// $(DIR)/amd_home \
| $(MAKEDBM) - $(YPDBDIR)/$(DOM)/amd.home; \
if [ ! $(NOPUSH) ]; then $(YPPUSH) amd.home; fi ; \
touch amd.home.time ; \
echo "updated amd.home"

amd.home: amd.home.time
...

On the FreeBSD client, AMD is started with the values in rc.conf :

amd_enable="YES"
amd_flags="-a /a -l syslog /net /etc/amd.map /home amd.home"


Hope this helps.
Regards.

Nicolas.

Tom Lislegaard

unread,
Mar 28, 2001, 5:49:17 AM3/28/01
to
Lars Josephsen wrote:

> Radomir Zoltowski <Radomir....@s3group.com> writes:
>
> > Could you lads give me a hand with setting up FreeBSD 4.0 NIS/NFS client
> > with Sun Solaris NIS/NFS 2.6 server?
> >
> > I have faced a problem with automounter. I CAN mount any FS from any Sun
> > machine, but no FS is mounted automatically. Also I can't log in to
> > FreeBSD with NIS user and password. However I CAN perform su!.
>
> I think your problem is that your Solaris system uses a different
> automounter from FreeBSD. Solaris uses autofs, like Linux, while
> FreeBSD uses the AutoMount Daemon (AMD).
>
> Autofs automount maps are not compatible with AMD, and vice versa.
>
> Theoretically, you should be able to compile and run AMD on Solaris.
> If you can't, or won't, do that, you are out of luck.

No, you don't need to run amd on Solaris. What you need is to maintain a
separate set of amd maps on your NIS server (or update config files manually
on the clients). I haven't done this for years myself, but I've attached a
script I used for doing automount->amd conversion.
This was on a SunOS NIS server, it may need some tweaking for
Solaris/autofs.

With small modifications to the NIS Makefile you can automate this to
convert and push corresponding amd maps whenever autofs-files are
updated.

-tom


>
>
> This is the reason why I only use BSDs for servers, and not
> workstations.
>
> Sincerely,
>
> Lars Josephsen
> --
> Do not reply to this address!
> To find my real address try a search for my name on Google.

----------------
#!/usr/local/bin/perl
#!/bin/sh -x
#eval 'exec perl -x -S $0 "$@"'
# if 0;
#!/bin/perl
#
# genamd: a Perl5 script for converting NIS Automount maps to
# AMD file maps.
#
# By: Patrick Hunt, Bob Withrow (bwit...@baynetworks.com)
#
# Copyright 1996 Bay Networks Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. All advertising materials mentioning features or use of this software
# must display the following acknowledgement:
# This product includes software developed by Bay Networks Inc.
# 4. The name of Bay Networks may not be used to endorse or promote
# products derived from this software without specific prior
# written permission.

$Version = "V1.0";
#
# Mods by Tom Lislegaard (t...@cmr.no):
# - added option '-s <srcdir>' to take input from files
# - changed code to recognize sublinks in automount map
#
$default_nfs_defaults="nosuid,grpid,rsize=8192,wsize=8192,noconn";
$default_output_directory="/etc/amd";
$default_exclude_regexp="(^/usr/(?!ccase))|(^/export/)";

sub usage {
die <<"EndUsage";
usage: genamd [-h] [-d "defaults"] [-o output_dir] [-x "exclude regexp"] [-r
"re
map regexp"]
This is genamd version $Version: it generates a set of amd
files based on the yp automount database.
Display Options:
-h Help -- just display this message and quit.
-v Verbose -- Be chatty.
-n Nismaps -- Generate NIS maps instead of file maps.
-d Default option for nfs mounts.
default: "$default_nfs_defaults"
-o Where to put the files that are generated.
default: "$default_output_directory"
-x Perl Regexp for excluding mountpoints from the output.
default: "$default_exclude_regexp"
-r Perl Regexp for remapping direct mountpoints.
default: ""
EndUsage
}

require "getopts.pl";
require "ctime.pl";

$date = &ctime(time);

&Getopts('vhnd:o:x:r:s:');
if ($@ || $opt_h) { &usage; }

if ($opt_d) {
$nfs_defaults = $opt_d;
} else {
$nfs_defaults = $default_nfs_defaults;
}

$verbose = 0;
if ($opt_v) {
$verbose = 1;
}

$nismaps = 0;
if ($opt_n) {
$nismaps = 1;
}

if ($opt_o) {
$output_directory = $opt_o;
} else {
$output_directory = $default_output_directory;
}

if ($opt_x) {
$exclude_regexp = $opt_x;
} else {
$exclude_regexp = $default_exclude_regexp;
}
if ($opt_s) {
$srcdir = $opt_s;
}

print "Writing output in \"$output_directory\"\n" if $verbose;

open(MASTER, "> ${output_directory}/amd.master");

if ( $srcdir ){
$mastersrc = "$srcdir/auto.master";
$verbose && print "Using srcfile \"$mastersrc\"\n";
open(INMASTER, "grep -v '^#' $mastersrc |");
} else {
open(INMASTER, "ypcat -k auto.master |");
}

print "excluding things that match \"$exclude_regexp\"\n" if $verbose;

INP: while (<INMASTER>) {
if (!(($mp, $map, $opts) = /^(\S+)\s+(\S+)\s+(\S+)\s*\n$/)){
if (!(($mp, $map) = /^(\S+)\s+(\S+)\s*\n$/)){ next; }
}
$opts =~ s/^-//;
print "$mp, $map, \"$opts\"..." if $verbose;
if ($mp eq "/-") {
print "direct mount\n" if $verbose;
do_map($mp,$map,$opts,1);
} elsif ($map eq "-hosts") {
print "net mount\n" if $verbose;
do_net($mp,"auto.net",$opts);
} else {
print "normal mount\n" if $verbose;
do_map($mp,$map,$opts,0);
}
}

close(INMASTER);
close(MASTER);
exit(0);

# Actually write the files here

sub do_map {
my($mp,$map,$opts,$direct) = @_;
my($out) = newmapname($map);
my($op,$hs,$loc,$dirname,$options);

$dirname = "normal";
$dirname = "direct" if $direct;

print "Doing $dirname mount table ($mp,$out,\"$opts\")\n" if $verbose;

if( $srcdir ){
$mapsrc = "$srcdir/$map";
print "Reading $map from $mapsrc...\n" if $verbose;
open(MAP, "grep -v '^#' $mapsrc 2>/dev/null |");
} else {
print "Reading $map from NIS...\n" if $verbose;
open(MAP, "ypcat -k $map 2>/dev/null |");
}
do {print "$map skipped!\n" if $verbose; close(MAP); return} if
(eof(MAP));


if ($nismaps) {
print(MASTER "$mp $out\n") if (!$direct);
} else {
print(MASTER "$mp ${output_directory}/$out\n") if (!$direct);
}

open(OUT, "> ${output_directory}/$out");

$options = "";
$options = ",$opts" if $opts ne "";

if (!$nismaps) {
print(OUT "#Generated using genamd.pl on ${date}\n");
}
print(OUT "/defaults opts:=${nfs_defaults}$options;\n");

INP: while (<MAP>) {
$sub = "";
$op = "";
$options = "";

if (!(($mp, $op, $hs, $loc) = /^(\S+)\s+-(\S+)\s+(\S+):(\S+)\s*\n$/))
{
if (!(($mp, $hs, $loc, $sub) =
/^(\S+)\s+(\S+):(\S+):(\S+)\s*\n$/))
{
if (!(($mp, $hs, $loc) = /^(\S+)\s+(\S+):(\S+)\s*\n$/)) {
next INP;
}
}
}

if ($exclude_regexp) {
$exclude = 0;
$exclude = 1 if ($mp =~ m{$exclude_regexp});
next INP if ($exclude);
}

if ($direct && ($opt_r)) {
eval "\$mp =~ $opt_r";
}

$options = "opts:=${op};" if ($op ne "");

$loc =~ s/(\&)|(\*)/\${key}/;

do {
if ($nismaps) {
print(MASTER "$mp $out -type:=direct\n");
} else {
print(MASTER "$mp ${output_directory}/$out -type:=direct\n");

}
$mp = substr($mp,1);
} if ($direct);

if($sub){
print(OUT "$mp -type:=nfs;sublink:=$sub;rfs:=$loc;${options}
");
} else {
print(OUT "$mp -type:=nfs;rfs:=$loc;${options} ");
}

@rhosts = split(/,/, $hs);

foreach $rhost (@rhosts) {
print(OUT "rhost:=$rhost ");
}

print(OUT "\n");
}

close(OUT);
close(MAP);
}

sub do_net {
my($mp,$map,$opts) = @_;
my($out) = newmapname($map);
print "Doing net mount table($mp,$out,\"$opts\")\n" if $verbose;
open(NET, "> ${output_directory}/$out");

if (!$nismaps) {
print(NET "#Generated using genamd.pl on ${date}\n");
}

print(NET "/defaults
type:=host;fs:=\${autodir}/net/\${rhost}/root;rhost:=\$
{key}\n* opts:=$opts,${nfs_defaults}\n");

close(NET);

if ($nismaps) {
print(MASTER "$mp $out\n");
} else {
print(MASTER "$mp ${output_directory}/$out\n");
}
}

sub newmapname {
my($mapname) = @_;
$mapname =~ s/auto/amd/;
return $mapname;
}


Radomir Zoltowski

unread,
Apr 5, 2001, 5:19:06 AM4/5/01
to
Hi lads,

Thanks, I have a lot to try...

0 new messages