Aller au contenu

Page liée

La configuration des clients est décrite dans NIS — client.

NIS (en cours de rédaction)

NIS (Network Information Service) permet de partager les users et les groupes d'un device à l'autre. Si on a un nouveau device (exemple : nouveau raspberry pi), on n'a juste à configurer le NIS sans avoir besoin de créer de nouveaux users/groups.
C'est le système qu'on a au CEA qui nous permet de nous loguer sur n'importe quelle machine avec notre mdp.

C'est un système qui permet de centraliser toutes les informations sur un serveur (chez moi : le NAS) pour que des clients (rpi, ordis) s'y connectent.

Installation

Côté serveur

  • Installer le packet nis :

apt-get install nis

  • Déclarer un nom de domaine :

sudo domainname primidi.domain

  • Éditer le fichier /etc/default/nis et ajouter deux lignes (NISSERVER et NISCLIENT) :
    /etc/default/nis
    #
    # /etc/defaults/nis     Optional configuration settings for the NIS programs.
    #
    
    # Are we a NIS server and if so what kind (values: false, slave, master)?
    NISSERVER=master
    
    # Are we a NIS client?
    NISCLIENT=false
    
    # Location of the master NIS password file (for yppasswdd).
    # If you change this make sure it matches with /var/yp/Makefile.
    YPPWDDIR=/etc
    
    # Do we allow the user to use ypchsh and/or ypchfn ? The YPCHANGEOK
    # fields are passed with -e to yppasswdd, see it's manpage.
    # Possible values: "chsh", "chfn", "chsh,chfn"
    YPCHANGEOK=chsh
    
    # NIS master server.  If this is configured on a slave server then ypinit
    # will be run each time NIS is started.
    NISMASTER=
    
    # Additional options to be given to ypserv when it is started.
    YPSERVARGS=
    
    # Additional options to be given to ypbind when it is started.
    YPBINDARGS=
    
    # Additional options to be given to yppasswdd when it is started.  Note
    # that if -p is set then the YPPWDDIR above should be empty.
    YPPASSWDDARGS=
    
    # Additional options to be given to ypxfrd when it is started.
    YPXFRDARGS=
    

=> Permet de déclarer la machine comme étant un serveur NIS

  • Éditer le fichier /var/yp/Makefile et remplacer :
    #ALL = passwd  group hosts rpc services netid protocols netgrp
    ALL = passwd shadow group hosts rpc services netid protocols netgrp
    

=> Je ne sais pas à quoi ça sert d'ajouter 'shadow'

  • Dans le même fichierr (/var/yp/Makefile) initialiser la plage d'uid et gid avec MINUID, MINGID, MAXUID, MAXGID, NFSNOBODYUID et NFSNOBODYGID:
    # 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
    

=> Tous les users et groups avec id>2000 seront concernés par le NIS. Il faut donc bien que les users créés le soient sur des uid et gid supérieurs à 2000.

  • Éditer le fichier /etc/yp.conf et ajouter une ligne :

ypserver 127.0.0.1 => Je ne sais pas exactement pourquoi

  • Exécuter la commande :

sudo /usr/lib/yp/ypinit -m => Permet d'initialiser le serveur NIS.

On doit obtenir ça :

At this point, we have to construct a list of the hosts which will run NIS
servers.  localhost 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:  localhost
        next host to add:  primidi
        next host to add:

The current list of NIS servers looks like this:

localhost
primidi

Is this correct?  [y/n: y]
We need a few minutes to build the databases...
Building /var/yp/primidi.domain/ypservers...
Running /var/yp/Makefile...
gmake[1]: Entering directory '/var/yp/primidi.domain'
Updating passwd.byname...
Updating passwd.byuid...
Updating shadow.byname...
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...
gmake[1]: Leaving directory '/var/yp/primidi.domain'

localhost has been set up as a NIS master server.

Now you can run ypinit -s localhost on all slave server.

Ancienne version

Côté serveur

  • Installer le packet nis :

apt-get install nis Lorsqu'on le demande, entrer un nom de domaine. Le miens = nas.domain.

  • Éditer le fichier /etc/default/nis et remplacer NISSERVER=false par NISSERVER=master

=> Permet de déclarer la machine comme étant un serveur NIS

  • Éditer le fichier /var/yp/Makefile et remplacer :
    #ALL =   passwd  group hosts rpc services netid protocols netgrp
    ALL =   passwd shadow group hosts rpc services netid protocols netgrp
    

=> Je ne sais pas à quoi ça sert d'ajouter 'shadow'

  • Éditer le fichier /etc/yp.conf et ajouter une ligne :

ypserver 127.0.0.1 => Je ne sais pas exactement pourquoi

  • Exécuter la commande :

sudo /usr/lib/yp/ypinit -m => Permet d'initialiser le serveur NIS.

On doit obtenir ça :

At this point, we have to construct a list of the hosts which will run NIS
servers.  nas 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:  nas
    next host to add:
The current list of NIS servers looks like this:

nas

Is this correct?  [y/n: y]
We need a few minutes to build the databases...
Building /var/yp/nas.domain/ypservers...
Running /var/yp/Makefile...
make[1]: Entering directory '/var/yp/nas.domain'
Updating passwd.byname...
Updating passwd.byuid...
Updating shadow.byname...
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...
make[1]: Leaving directory '/var/yp/nas.domain'

nas has been set up as a NIS master server.

Now you can run ypinit -s nas on all slave server.