Difference between revisions of "Cluster der kan alt/LDAP eller NIS"
From Teknologisk videncenter
Line 15: | Line 15: | ||
</source> | </source> | ||
*Ret '''/etc/ypserv.securenets''' fjern '''0.0.0.0''' linjen - insecure - og at dit eget net. | *Ret '''/etc/ypserv.securenets''' fjern '''0.0.0.0''' linjen - insecure - og at dit eget net. | ||
+ | |||
+ | ==Adding a user== | ||
+ | Efter du har oprettet en ny bruger, '''adduser''' er det nødvendigt at genopbygge nis maps! | ||
+ | <source lang=cli> | ||
+ | root@head:~# <input>make -C /var/yp</input> | ||
+ | make: Går til katalog '/var/yp' | ||
+ | make[1]: Går til katalog '/var/yp/c1.local' | ||
+ | Updating passwd.byname... | ||
+ | Updating passwd.byuid... | ||
+ | Updating netid.byname... | ||
+ | Updating shadow.byname... | ||
+ | make[1]: Forlader katalog '/var/yp/c1.local' | ||
+ | make: Forlader katalog '/var/yp' | ||
+ | </source> | ||
+ | ===Script adding user in a Cluster=== | ||
+ | The following simple script: | ||
+ | *Add a user on the NIS server. | ||
+ | *Add a ssh key to the users '''/home''' library. | ||
+ | **In this cluster '''/home''' is distributed with [[NFS]] to all nodes. Logon to nodes without entering password | ||
+ | *Rebuilding the NIS database with the new user | ||
+ | <source lang=cli> | ||
+ | #!/bin/bash | ||
+ | echo -e "Adding user to cluster" | ||
+ | echo -e "======================\n" | ||
+ | echo -en "User login name: " | ||
+ | read NAME | ||
+ | adduser $NAME | ||
+ | |||
+ | echo -e "Creating keys" | ||
+ | su $NAME -c "ssh-keygen -t dsa" | ||
+ | echo -e "Distributing keys" | ||
+ | su $NAME -c "cat /home/$NAME/.ssh/id_dsa.pub >> /home/$NAME/.ssh/authorized_keys" | ||
+ | echo -e "Rebuild NIS database" | ||
+ | make -C /var/yp | ||
+ | </source> | ||
+ | |||
+ | =Installation på klienten= | ||
+ | Installer software | ||
+ | <source lang=cli> | ||
+ | sudo apt-get install portmap nis | ||
+ | </source> | ||
+ | Kør disse kommandoer, hvor NIS_SERVER_IP = din nis server ip | ||
+ | <source lang=cli> | ||
+ | echo "portmap : <notice>NIS_SERVER_IP</notice> >> /etc/hosts.allow | ||
+ | echo "+::::::" >> /etc/passwd | ||
+ | echo "+:::" >> /etc/group | ||
+ | echo "+::::::::" >> /etc/shadow | ||
+ | echo "ypserver <notice>NIS_SERVER_IP</notice> >> /etc/yp.conf | ||
+ | /etc/init.d/nis restart | ||
+ | </source> | ||
+ | Test med | ||
+ | <source lang=cli> | ||
+ | yptest | ||
+ | </source> | ||
+ | {{source cli}} |
Revision as of 07:40, 24 April 2012
Contents
Installation af master server
Tilføj følgende linje til /etc/hosts.allow.
portmap ypserv ypbind: 10.0.0.0/255.255.255.0
Installer NIS. Du vil blive bedt om at indtaste domænenavnet. Domænenavnet er ikke DNS-domænenavn - men et unikt navn for klyngen af maskiner deler de samme oplysninger.
apt-get install portmap nis
- Ret /etc/default/nis og set NISSERVER linjen to NISSERVER = master
- Ret /etc/yp.conf og tilføj en linje med:
domain dka.local server 127.0.0.1
- Ret /etc/ypserv.securenets fjern 0.0.0.0 linjen - insecure - og at dit eget net.
Adding a user
Efter du har oprettet en ny bruger, adduser er det nødvendigt at genopbygge nis maps!
root@head:~# <input>make -C /var/yp</input>
make: Går til katalog '/var/yp'
make[1]: Går til katalog '/var/yp/c1.local'
Updating passwd.byname...
Updating passwd.byuid...
Updating netid.byname...
Updating shadow.byname...
make[1]: Forlader katalog '/var/yp/c1.local'
make: Forlader katalog '/var/yp'
Script adding user in a Cluster
The following simple script:
- Add a user on the NIS server.
- Add a ssh key to the users /home library.
- In this cluster /home is distributed with NFS to all nodes. Logon to nodes without entering password
- Rebuilding the NIS database with the new user
#!/bin/bash
echo -e "Adding user to cluster"
echo -e "======================\n"
echo -en "User login name: "
read NAME
adduser $NAME
echo -e "Creating keys"
su $NAME -c "ssh-keygen -t dsa"
echo -e "Distributing keys"
su $NAME -c "cat /home/$NAME/.ssh/id_dsa.pub >> /home/$NAME/.ssh/authorized_keys"
echo -e "Rebuild NIS database"
make -C /var/yp
Installation på klienten
Installer software
sudo apt-get install portmap nis
Kør disse kommandoer, hvor NIS_SERVER_IP = din nis server ip
echo "portmap : <notice>NIS_SERVER_IP</notice> >> /etc/hosts.allow
echo "+::::::" >> /etc/passwd
echo "+:::" >> /etc/group
echo "+::::::::" >> /etc/shadow
echo "ypserver <notice>NIS_SERVER_IP</notice> >> /etc/yp.conf
/etc/init.d/nis restart
Test med
yptest