Mudanças entre as edições de "Minicluster:NIS"

De WikiLICC
Ir para: navegação, pesquisa
m
m (Cliente NIS)
 
(37 revisões intermediárias pelo mesmo usuário não estão sendo mostradas)
Linha 1: Linha 1:
 +
É necessário informar um nome de domínio NIS (que pode ser diferente do domínio DNS matrix). Foi informado <code>nismatrix</code>
 +
 
== Servidor NIS ==
 
== Servidor NIS ==
 +
* Setar o serviço '''time''' para rodar via inetd/xinetd, ou configure xntpd, ou de outro modo certifique-se que o relógio do host esteja sincronizado.
 +
 
* Instale o servidor NIS
 
* Instale o servidor NIS
  [root@one]$ yum install ypserv
+
  [one]# dnf install yp-tools
  [root@one]$ chkconfig --level 345 ypserv on   
+
[one]# dnf install ypbind
 +
[one]# dnf install ypserv
 +
  [one]# dnf install rpcbind      # já instalado no NFS
 +
 
 +
* Edite /etc/yp.conf:
 +
#domain internal server IP_DO_SERVIDOR
 +
domain nismatrix server 192.168.0.100    # ou localhost
 +
 
 +
* Edite /etc/ypserv.conf:
 +
..
 +
dns: no
 +
files: 30
 +
xfr_check_port: yes
 +
* : * : shadow.byname : port
 +
* : * : passwd.adjunct.byname : port
 +
 
 +
* Edite /etc/sysconfig/network:
 +
NISDOMAIN="nismatrix"
 +
 
 +
* Setar o nome do domínio NIS:
 +
[one]# domainname  nismatrix
 +
[one]# ypdomainname nismatrix
 +
 
 +
* Crie o arquivo /var/yp/securenets:
 +
host 127.0.0.1
 +
255.255.255.0  192.168.0.0
  
 +
* Certifique-se que o serviço ''rpcbind'' está rodando
 +
[one]# systemclt start  rpcbind
 +
[one]# chkconfig rpcbind on
 +
<!--** Portmap will need a rule in /etc/hosts.allow to allow access from localhost and any hosts that need to access NIS.-->
  
== Cliente NIS ==
+
* Editar linhas em
  [root@cell100]$ chkconfig --level 345 ypbind on   
+
[one]$ vi /var/yp/Makefile
 +
..
 +
ALIASES    = $(YPSRCDIR)/aliases  # aliases could be in /etc or /etc/mail
 +
#ALIASES    = /etc/mail/aliases
 +
 
 +
 
 +
* Inicie o serviço ypserv:
 +
[one]# service ypserv start
 +
 
 +
* Verifique se está escutando
 +
[one]# rpcinfo -u localhost ypserv
 +
program 100004 version 1 ready and waiting
 +
program 100004 version 2 ready and waiting
 +
 
 +
* Inicialize o mapeamento NIS (especifique one.matrix, Ctrl-D, y, e deixe finalizar):
 +
[one]$ /usr/lib64/yp/ypinit -m
 +
 
 +
  # one has been set up as a NIS master server.
 +
  # Now you can run ypinit -s one on all slave server.
 +
 
 +
 
 +
* Inicie ypbind, yppasswdd, ypxfrd:
 +
[one]# systemctl start ypbind
 +
[one]# systemctl start yppasswdd
 +
[one]# systemctl start ypxfrd
 +
 
 +
* Configure os serviços YP para iniciar no boot:
 +
[one]# systemctl enable ypserv
 +
[one]# systemctl enable ypbind
 +
[one]# systemctl enable yppasswdd
 +
[one]# systemctl enable ypxfrd
 +
 
 +
== Cliente NIS (usando DRBL)==
 +
* Verificar que estejam instalado os pacotes:  yp-tools ypbind rpcbind (antigamente portmap)
 +
 
 +
* Edite /etc/sysconfig/network:
 +
NISDOMAIN=nismatrix
 +
 
 +
* Edite /etc/yp.conf:
 +
domain nismatrix server 192.168.0.99
 +
#domain nismatrix server localhost  #Hmmm... (localhost ou ip)
 +
 
 +
* Edite /etc/hosts:
 +
192.168.0.99  one.matrix  one
 +
 
 +
* Setar o nome do domínio NIS:
 +
[cell100]# domainname  nismatrix
 +
[cell100]# ypdomainname nismatrix
 +
 
 +
* Editar /etc/nsswitch.conf:
 +
..
 +
passwd:    files nis
 +
shadow:    files nis
 +
group:      files nis
 +
..
 +
 
 +
* Verifique que o serviço rpcbind está rodando:
 +
[cell100]# service  rpcbind start
 +
[cell100]# chkconfig rpcbind on
 +
** The /etc/hosts.allow file will need rules allowing access from localhost and the NIS master server.
 +
 
 +
* Inicie o serviço ypbind:
 +
[cell100]# service  ypbind start
 +
  [cell100]# chkconfig ypbind on
 +
 
 +
* Teste:
 +
[cell100]# rpcinfo -u localhost ypbind
 +
[cell100]# ypcat passwd
 +
 
 +
== Gerenciando usuários ==
 +
Tarefas para o '''root''' realizar no servidor NIS
 +
 
 +
;Adicionar usuário: Use uma das opções
 +
[one]# useradd -g docente usuario
 +
  ou
 +
[one]# useradd -m -g docente -p password usuario  # cria o diretório home
 +
onde grupo=docente (foi necessário usar -p password para que funcionasse)
 +
;Atualizar o banco de dados NIS
 +
[one]# make -C /var/yp
 +
 
 +
;Trocar a senha do usuário
 +
[one]# yppasswd -p usuario
 +
 
 +
Usuários trocaram a senha usando o comando '''yppasswd''' ao invés  de '''passwd''' que afeta o arquivo local. Quando usando um escravo NIS, não modifique a senha enquanto logado no servidor NIS (why?).
  
 
== Referências ==
 
== Referências ==
 +
* http://bradthemad.org/tech/notes/redhat_nis_setup.php, walkthrough completo
 
* http://under-linux.org/wiki/Tutoriais/LDAP/LDAP-NIS-NFS
 
* http://under-linux.org/wiki/Tutoriais/LDAP/LDAP-NIS-NFS
 
* http://www.wellho.net/solutions/general-what-are-nis-ldap-dns-and-bind.html
 
* http://www.wellho.net/solutions/general-what-are-nis-ldap-dns-and-bind.html
 +
* http://bradthemad.org/tech/notes/redhat_nis_setup.php
 +
* http://www.yolinux.com/TUTORIALS/NIS.html
 +
* http://www.tldp.org/HOWTO/NIS-HOWTO/ypserv.html
 +
 +
* http://docs.sun.com/app/docs/doc/802-3884/6i7ogkaot?a=view Problemas com ypbind, ypwhich

Edição atual tal como às 22h22min de 27 de junho de 2017

É necessário informar um nome de domínio NIS (que pode ser diferente do domínio DNS matrix). Foi informado nismatrix

Servidor NIS

  • Setar o serviço time para rodar via inetd/xinetd, ou configure xntpd, ou de outro modo certifique-se que o relógio do host esteja sincronizado.
  • Instale o servidor NIS
[one]# dnf install yp-tools
[one]# dnf install ypbind
[one]# dnf install ypserv
[one]# dnf install rpcbind       # já instalado no NFS 
  • Edite /etc/yp.conf:
#domain internal server IP_DO_SERVIDOR
domain nismatrix server 192.168.0.100    # ou localhost
  • Edite /etc/ypserv.conf:
..
dns: no
files: 30
xfr_check_port: yes
* : * : shadow.byname : port
* : * : passwd.adjunct.byname : port 
  • Edite /etc/sysconfig/network:
NISDOMAIN="nismatrix"
  • Setar o nome do domínio NIS:
[one]# domainname   nismatrix
[one]# ypdomainname nismatrix
  • Crie o arquivo /var/yp/securenets:
host 127.0.0.1
255.255.255.0   192.168.0.0
  • Certifique-se que o serviço rpcbind está rodando
[one]# systemclt start  rpcbind
[one]# chkconfig rpcbind on
  • Editar linhas em
[one]$ vi /var/yp/Makefile
..
ALIASES     = $(YPSRCDIR)/aliases  # aliases could be in /etc or /etc/mail
#ALIASES    = /etc/mail/aliases


  • Inicie o serviço ypserv:
[one]# service ypserv start
  • Verifique se está escutando
[one]# rpcinfo -u localhost ypserv
program 100004 version 1 ready and waiting
program 100004 version 2 ready and waiting
  • Inicialize o mapeamento NIS (especifique one.matrix, Ctrl-D, y, e deixe finalizar):
[one]$ /usr/lib64/yp/ypinit -m
 # one has been set up as a NIS master server.
 # Now you can run ypinit -s one on all slave server.


  • Inicie ypbind, yppasswdd, ypxfrd:
[one]# systemctl start ypbind
[one]# systemctl start yppasswdd
[one]# systemctl start ypxfrd
  • Configure os serviços YP para iniciar no boot:
[one]# systemctl enable ypserv
[one]# systemctl enable ypbind
[one]# systemctl enable yppasswdd
[one]# systemctl enable ypxfrd

Cliente NIS (usando DRBL)

  • Verificar que estejam instalado os pacotes: yp-tools ypbind rpcbind (antigamente portmap)
  • Edite /etc/sysconfig/network:
NISDOMAIN=nismatrix
  • Edite /etc/yp.conf:
domain nismatrix server 192.168.0.99
#domain nismatrix server localhost  #Hmmm... (localhost ou ip)
  • Edite /etc/hosts:
192.168.0.99  one.matrix  one
  • Setar o nome do domínio NIS:
[cell100]# domainname   nismatrix
[cell100]# ypdomainname nismatrix
  • Editar /etc/nsswitch.conf:
..
passwd:     files nis
shadow:     files nis
group:      files nis
..
  • Verifique que o serviço rpcbind está rodando:
[cell100]# service   rpcbind start
[cell100]# chkconfig rpcbind on
    • The /etc/hosts.allow file will need rules allowing access from localhost and the NIS master server.
  • Inicie o serviço ypbind:
[cell100]# service   ypbind start
[cell100]# chkconfig ypbind on
  • Teste:
[cell100]# rpcinfo -u localhost ypbind
[cell100]# ypcat passwd

Gerenciando usuários

Tarefas para o root realizar no servidor NIS

Adicionar usuário
Use uma das opções
[one]# useradd -g docente usuario
 ou
[one]# useradd -m -g docente -p password usuario   # cria o diretório home

onde grupo=docente (foi necessário usar -p password para que funcionasse)

Atualizar o banco de dados NIS
[one]# make -C /var/yp
Trocar a senha do usuário
[one]# yppasswd -p usuario

Usuários trocaram a senha usando o comando yppasswd ao invés de passwd que afeta o arquivo local. Quando usando um escravo NIS, não modifique a senha enquanto logado no servidor NIS (why?).

Referências