NIS (Network Information Service) ands the name of a protocol directory servicesclient-server developed by Sun Microsystems for sending configuration data in distributed systems such as usernames and hosts between computers over a network.
NIS está basado en ONC RPC, and consists of a server, a client-side library, and various administration tools.
First we verify that we have all these files and we create the ones that are not there.
/etc/auto_home (Esta creado)/etc/auto_master (Esta creado)/etc/bootparams (Hay que crearlo)/etc/ethers (Esta creado)/etc/group (Esta creado)/etc/hosts (Esta creado)/etc/inet/ipnodes (Esta creado)/etc/mail/aliases (Esta creado)/etc/netgroup (Hay que crearlo)/etc/netid (Hay que crearlo)/etc/netmasks (Esta creado)/etc/networks (Esta creado)/etc/passwd (Esta creado)/etc/protocols (Esta creado)/etc/publickey (Esta creado)/etc/rpc should (Esta creado)/etc/services (Esta creado)/etc/shadow (Esta creado)/etc/timezone (Hay que crearlo)/etc/auth_attr (Copiar fichero de: /etc/security/)/etc/exec_attr (Copiar fichero de: /etc/security/exec_attr )/etc/prof_attr (Copiar fichero de: /etc/security/prof_attr )/etc/audit_user (Copiar fichero de: /etc/security/audit_user )In order not to lose any type of configuration or important file, we make a backup copy of the file.
nsswitch.conf
cp /etc/nsswitch.conf /etc/nsswitch.conf.oldWe copy the configuration from the file nsswitch.nis to nsswitch.conf
cp /etc/nsswitch.nis /etc/nsswitch.confWithin the file we have to modify some lines.
we change
hosts: nis [NOTFOUND=return] filesby
hosts: files nis dnsand we also change this parameter
automount: files nisby
automount: nis filesNext we create the structure where we are going to export the configuration files of the nis server users.
mkdir -p /etc/nis/etc/securitywithin /etc/nis/etc/ we copy the files: passwd and shadow
cp /etc/passwd /etc/nis/etc/cp /etc/shadow /etc/nis/etc/We edit the file /etc/nis/etc/passwd and we delete all users from the system (root,daemon,bin,sys,adm,lp,uucp,nuucp,smmsp,listen,gdm,webservd,nobody,noaccess,nobody4)
cd /etc/nis/etcvi passwdEdit each user entry, removing the password placeholder (“x” in the second field) and replacing it with two hashes and the username. Example:
operador:##operador:100:1::/export/home/operador:bin/bashSo as not to do it one by one...
we make a copy
cp passwd passwd.orig
and we edit the file with an awk
nawk -F “:” ’{printf “% s: # #% s:% s:% s:% s:% s:% s \ n “, $ 1, $ 1, $ 3, $ 4, $ 5, $ 6, $ 7}’ passwd.orig > passwdWe generate the file passwd.adjunct
nawk -F ”:” ’{printf “% s:% s ::::: \ n”, $ 1, $ 2}’ passwd.orig > security/passwd.adjunctWe modify the file Makefile.
cd /var/ypvi MakefileWe look for the following line and change it:
PWDIR = /etcby
PWDIR = /etc/nis/etcWe also modify the following line:
c2secure:
-@if [ -f $(PWDIR)/security/passwd.adjunct ]; then \
if [ ! $(NOPUSH) ]; then $(MAKE) $(MFLAGS) -k \
passwd.adjunct.time group.adjunct.time; \
else $(MAKE) $(MFLAGS) -k NOPUSH=$(NOPUSH) \
passwd.adjunct.time group.adjunct.time; \
fi; \
fiby
c2secure:
-@if [ -f $(PWDIR)/security/passwd.adjunct ]; then \
if [ ! $(NOPUSH) ]; then $(MAKE) $(MFLAGS) -k \
passwd.adjunct.time; \
else $(MAKE) $(MFLAGS) -k NOPUSH=$(NOPUSH) \
passwd.adjunct.time; \
fi; \
fiWe also delete all the users that are not necessary in the file /etc/nis/etc/shadow
(root,daemon,bin,sys,adm,lp,uucp,nuucp,smmsp,listen,gdm,webservd,nobody,noaccess,nobody4)
We add a domain name
domainame red-orbita.eswe make it permanent
domainname > /etc/defaultdomainWe promote as master server.
/usr/sbin/ypinit -mIt will ask us for the name of the server and check all the files and configuration in case there are any errors.
To check that everything is correct, just enter:
ypwhichand if we want to see the users
ycat passwdGreetings, rokitoh!
Comments