Le contenu de cette section est identique à la version précédente : Synthèse NFS v3 & NIS. On ne reprend que les étapes essentielles de validation du fonctionnement du service.
Il faut installer le paquet baptisé nis sur
le serveur et sur le client. C'est en éditant le fichier de configuration
du service /etc/default/nis que l'on attribue le rôle
client ou serveur. Par défaut, c'est le rôle «client» qui est
attribué ce qui suppose donc qu'un serveur est déjà en place lors de
l'installation.
On attribue le rôle serveur avec l'option
NISSERVER.
# head -10 /etc/default/nis # # /etc/defaults/nis Configuration settings for the NIS daemons. # # Are we a NIS server and if so what kind (values: false, slave, master) NISSERVER=master # Are we a NIS client (i.e. start ypbind?) NISCLIENT=true
On désigne manuellement ce serveur en éditant le fichier
/etc/yp.conf.
# cat /etc/yp.conf <snipped/> # # IMPORTANT: For the "ypserver", use IP addresses, or make sure that # the host is in /etc/hosts. This file is only interpreted # once, and if DNS isn't reachable yet the ypserver cannot # be resolved and ypbind won't ever bind to the server. # ypserver ypserver.network.com ypserver 127.0.0.1
On relance ensuite le servicei.
# /etc/init.d/nis restart Starting NIS services: ypserv yppasswdd ypxfrd ypbind.
On contrôle de la liste des services RPC disponibles.
# rpcinfo -p
program no_version protocole no_port
100000 2 tcp 111 portmapper
100000 2 udp 111 portmapper
100003 2 udp 2049 nfs
100003 3 udp 2049 nfs
100003 4 udp 2049 nfs
100021 1 udp 34319 nlockmgr
100021 3 udp 34319 nlockmgr
100021 4 udp 34319 nlockmgr
100003 2 tcp 2049 nfs
100003 3 tcp 2049 nfs
100003 4 tcp 2049 nfs
100021 1 tcp 53676 nlockmgr
100021 3 tcp 53676 nlockmgr
100021 4 tcp 53676 nlockmgr
100005 1 udp 52890 mountd
100005 1 tcp 42001 mountd
100005 2 udp 52890 mountd
100005 2 tcp 42001 mountd
100005 3 udp 52890 mountd
100005 3 tcp 42001 mountd
100004 2 udp 667 ypserv
100004 1 udp 667 ypserv
100004 2 tcp 668 ypserv
100009 1 udp 670 yppasswdd
100004 1 tcp 668 ypserv
600100069 1 udp 673 fypxfrd
600100069 1 tcp 674 fypxfrd
100007 2 udp 682 ypbind
100007 1 udp 682 ypbind
100007 2 tcp 683 ypbind
100007 1 tcp 683 ypbind
Une fois le serveur en place, il faut créer les bases de données
distribuées par le service NIS. Ces bases étant stockées
dans le répertoire /var/yp/, c'est à
partir de ce répertoire que toutes les opérations suivantes doivent être
effectuées.
Pour commencer, on édite le fichier Makefile qui
contient l'ensemble des directives de manipulation des bases. On
s'intéresse plus particulièrement à 2 sections du fichier.
On fixe arbitrairement la valeur minimum des
uid et gid à 2000 de
façon à éviter tout «mélange» avec la base de données des comptes
utilisateur locaux du serveur NIS.
# We do not put password entries with lower UIDs (the root and system # entries) in the NIS password database, for security. MINUID is the # lowest uid that will be included in the password maps. If you # create shadow maps, the UserID for a shadow entry is taken from # the passwd file. If no entry is found, this shadow entry is # ignored. # MINGID is the lowest gid that will be included in the group maps. MINUID=2000 MINGID=2000
auto.master,
auto.home
On complète la liste des bases ou «cartes» gérées par le service NIS en y ajoutant les fichiers de configuration de l'automontage NFS. De cette façon, on évite d'avoir à configurer le service d'automontage sur tous les postes clients.
# If you don't want some of these maps built, feel free to comment # them out from this list. ALL = passwd group hosts rpc services netid protocols netgrp ALL += auto.master auto.home
Comme la configuration de l'automontage n'est pas encore traitée, on se contente de créer des fichiers vides de façon à ne pas bloquer le fonctionnement du service NIS.
rubis:/var/yp# touch /etc/auto.master rubis:/var/yp# touch /etc/auto.home
Une fois le fichier Makefile prêt, on lance la
création des bases avec la commande ypinit.
rubis:/var/yp# /usr/lib/yp/ypinit -m
At this point, we have to construct a list of the hosts which will run NIS
servers. rubis is in the list of NIS server hosts. Please continue to add
the names for the other hosts, one per line. When you are done with the
list, type a <control D>.
next host to add: rubis
next host to add:
The current list of NIS servers looks like this:
rubis
Is this correct? [y/n: y]
We need a few minutes to build the databases...
Building /var/yp/nis.lab/ypservers...
Running /var/yp/Makefile...
make[1]: Entering directory `/var/yp/nis.lab'
Updating passwd.byname...
Updating passwd.byuid...
Updating group.byname...
Updating group.bygid...
Updating hosts.byname...
Updating hosts.byaddr...
Updating rpc.byname...
Updating rpc.bynumber...
Updating services.byname...
Updating services.byservicename...
Updating netid.byname...
Updating protocols.bynumber...
Updating protocols.byname...
Updating netgroup...
Updating netgroup.byhost...
Updating netgroup.byuser...
Updating auto.master...
Updating auto.home...
Updating shadow.byname...
make[1]: Leaving directory `/var/yp/nis.lab'
rubis has been set up as a NIS master server.
Now you can run ypinit -s rubis on all slave server.
Pour les tests sur les services NIS et
NFS on utilise un compte utilisateur spécifique baptisé
etu-nis.
|
On désigne un nouveau répertoire racine pour les comptes utilisateurs distribués par le service NIS. Ce répertoire sera utilisé par le service d'automontage NFS. |
|
|
Conformément à la règle adoptée lors de la création des bases
NIS, on doit fixer une valeur
d' |
rubis:/var/yp# mkdir /home/nis rubis:/var/yp# adduser --home /home/nis/etu-nis--uid 2000
etu-nis Ajout de l'utilisateur etu-nis... make: Entering directory `/var/yp' make[1]: Entering directory `/var/yp/nis.lab' Updating netid.byname... make[1]: Leaving directory `/var/yp/nis.lab' make: Leaving directory `/var/yp' Adding new group `etu-nis' (2000). make: Entering directory `/var/yp' make[1]: Entering directory `/var/yp/nis.lab' Updating group.byname... Updating group.bygid... Updating netid.byname... make[1]: Leaving directory `/var/yp/nis.lab' make: Leaving directory `/var/yp' Adding new user `etu-nis' (2000) with group `etu-nis'. make: Entering directory `/var/yp' make[1]: Entering directory `/var/yp/nis.lab' Updating passwd.byname... Updating passwd.byuid... Updating netid.byname... Updating shadow.byname... make[1]: Leaving directory `/var/yp/nis.lab' make: Leaving directory `/var/yp' Création du répertoire personnel /home/nis/etu-nis. Copie des fichiers depuis /etc/skel Enter new UNIX password: Retype new UNIX password: passwd: password updated successfully Modification des informations relatives à l'utilisateur etu-nis Entrez la nouvelle valeur ou « Entrée » pour conserver la valeur proposée Nom complet []: Etudiant NIS No de bureau []: Téléphone professionnel []: Téléphone personnel []: Autre []: Ces informations sont-elles correctes ? [o/N] o
D'une façon générale, à chaque modification d'un objet de la base de
données du service NIS, il faut relancer la scrutation
des directives listées dans le Makefile.
rubis:/var/yp# make make[1]: Entering directory `/var/yp/nis.lab' Updating passwd.byname... Updating passwd.byuid... Updating netid.byname... Updating shadow.byname... make[1]: Leaving directory `/var/yp/nis.lab'
Côté client, il faut aussi installer le paquet Debian
nis et reprendre le nom de domaine choisi lors de
la configuration du serveur.
saphir:~# apt-get install nis saphir:~# nisdomainname nis.lab saphir:~# ypwhich rubis
Une fois le démon ypbind
lancé, on effectue un test d'accès à une base distribuée via
NIS :
saphir:~# ypcat hosts 127.0.0.1 localhost 192.168.1.7 saphir 192.168.1.4 rubis
On suit ensuite les indications données dans les deux guides de
configuration NIS : section Setting Up
the NIS Client du guide The Linux NIS(YP)/NYS/NIS+ HOWTO et|ou section
HOW TO SETUP A LOCAL NIS CLIENT de la Documentation du paquet Debian nis.
On complète la configuration pour que les utilisateurs NIS puissent se connecter sur le client :
saphir:~# echo "+::::::" >>/etc/passwd saphir:~# echo "+::::::::" >>/etc/shadow saphir:~# echo "+:::" >>/etc/group
Pour tester l'authentification de l'utilisateur test etu-nis, soit on utilise la commande
su etu-nis, soit on utilise une console. Voici ce
que l'on obtient sur la console n° 2 :
Debian GNU/Linux 3.1 saphir tty2 saphir login: etu-nis Password: Linux saphir 2.6.12-rc3 #3 Sun May 1 17:29:27 CEST 2005 i686 GNU/Linux The programs included with the Debian GNU/Linux system are free software; the exact distribution terms for each program are described in the individual files in /usr/share/doc/*/copyright. Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law. No directory, logging in with HOME=/etu-nis@saphir:/$
Vous êtes ici :