Make your server as NIS client. (Info: authconfig-tui and put nisdomainname and server name/ip)
1. ypcat passwd > /tmp/passwd.nis (Extracting username/password information from NIS server to our text file.)
2. ypcat group > /tmp/group.nis (Extracting group information from NIS server to our text file.)
3. service ypbind stop (Unbinding our server from NIS)
4. for i in $( cut –f1-2 –d: /tmp/passwd.nis ); do
echo “$i:$[$(date +%s)/86400]:0:99999:7:::”
done > /tmp/shadow.nis (Extracting password into separate shadow file.)
5. sed –r ‘s/\$1\$.{8}\$.{22}/x/g’ /tmp/passwd.nis > /tmp/passwd-new.nis (Removing password entry from original file {/tmp/passwd.nis} which we exported from NIS server.)
6. mv /tmp/passwd-new.nis /tmp/passwd.nis (Moving new passwd file with password value x to original file.)
7. cd /usr/share/openldap/migration
8. Vi migration_common.ph
$DEFAULT_MAIL_DOMAIN = “server101.example.com” (Server Name)
$DEFAULT_BASE= “dc=example,dc=com” (Directory Server Suffix.)
$EXTENDED_SCHEMA =1 (Extended Schema = 1 so that extra attribute could be saved along with user, password and group like email address.)
9. ./migrate_base.pl > /tmp/base.lidf (Base ldif file for creation of extra ou like hosts.)
10. vi migrate_passwd.pl
Search for shadow
And replace this line from
Open(SHADOW, “/etc/shadow”)
To
Open(SHADOW, “/tmp/shadow.nis”)
11. ./migrate_passwd.pl /tmp/passwd.nis /tmp/passwd.ldif (Preparing password ldif file for importing into Directory Server.)
12. ./migrate_group.pl /tmp/group.nis /tmp/group.ldif (Preparing group ldif file for importing into Directory Server.)
13. vim /etc/openldap/ldap.conf
Add these values :
HOST server101.example.com
BASE dc=example,dc=com
14. vim /root/.ldaprc
Add these values :
BINDDN cn=Directory Manager
15. ldapadd –x –c –W –f /tmp/base.ldif (Base ldif upload into Directory Server. When asked put password of Directory Manager. That is password.)
16. ldapadd –x –c –W –f /tmp/group.ldif (Group upload into Directory Server. When asked put password of Directory Manager. That is password.)
17. ldapadd –x –c –W –f /tmp/passwd.ldif (Password ldif upload into Directory Server. When asked put password of Directory Manager. That is password.)
18. authconfig-tui (Make your server client of your Directory server.)
Regards
Tapan Kumar Thapa
Jetking Diploma Holder, MCSE, CCNA, RHCE, RHCSS (EX333,EX423 Certified)
No comments:
Post a Comment