Linux_LDAP+NFS+autofs

简介: 目录目录前言LdapLDAPNFSautofsServerPost前言LDAP+NFS+Autofs也是一种网络用户集中管理解决方案,相对于NIS+NFS+Autofs而言,有着更可靠的安全性。

目录

前言

LDAP+NFS+Autofs也是一种网络用户集中管理解决方案,相对于NIS+NFS+Autofs而言,有着更可靠的安全性。

Ldap

LDAP(Lightweight Directory Access Protocol)轻量目录访问协议,它基于X.500标准的,与X.500不同,LDAP支持TCP/IP,这对访问Internet是必须的。LDAP的核心规范在RFC中都有定义,所有与LDAP相关的RFC都可以在LDAPman RFC网页中找到。

LDAP+NFS+autofs

ServerPost

step1.

yum install -y openldap openldap-clients openldap-servers

step2.Change the dynamic ldap config file.

mv slapd.d slapd.d.bak --> /etc/openldap

step3. Use the static ldap config file.

cp /usr/share/openldap-servers/slapd.conf.obsolete /etc/openldap/slapd.conf

step4. Edit the LDAP config file in the section “database definitions” as below:
vim /etc/openldap/slapd.conf

        # database definitions
        ################################################################

        database        bdb
        suffix          "dc=nice,dc=com"
        checkpoint      1024 15
        rootdn          "cn=Manager,dc=nice,dc=com"
        rootpw            fanguiju
        #################################################################
        #the meaning is assign the domain for storage the user account.
        #        cn=Manager-->ManagerAccount
        #        dc=nice,dc=com-->storage user account domain

step5. Edit the ldap domain database config file.

cp /usr/share/openldap-servers/DB_CONFIG.example /var/lib/ldap/DB__CONFIG

chown ldap:ldap DB_CONFIG

step6. Start ldap service

service ldap start
ldapsearch -x -b "dc=nice,dc=com"
        -x #简单明文方式发送

step6. Converting local user infomation into LDAP user infomation also storage the LDAP user infomation to the database file.

yum install -y migrationtools  --> migrationtools is a format conversion.

vim /usr/share/migrationtools/migrate_common.ph

        $DEFAULT_MAIL.DOMAIN="nice.com"
        $DEFAULT_BASE="dc=nice,dc=com"

Create base.ldif

 ./migrate_base.pl > base.ldif  #Converting the base info into LDAP info
 #Edit the base.ldif file as below(keep base item of nice,People,Group):
            dn: dc=nice,dc=com
            dc: nice
            objectClass: top
            objectClass: domain

            dn: ou=People,dc=nice,dc=com
            ou: People
            objectClass: top   
            objectClass: organizationalUnit

            dn: ou=Group,dc=nice,dc=com
            ou: Group
            objectClass: top
            objectClass: organizationalUnit

Create user.ldif

./migrate_passwd.pl /etc/passwd > user.ldif   #Converting the user info into LDAP info, if you want to keep therein some user ,you can cut the user info in the passwd file also storage it to new file.将要加入到LDAP的用户留下

Create group.ldif

./migrate_group.pl /etc/group > group.ldif    #Converting the group info into LDAP info, idem.

step7. After converting,import the LDAP info to the DB file.

ldapadd -D "cn=Manager,dc=nice,dc=com" -W -x -f base.ldif #input password of "jmilkfan".
ldapadd -D "cn=Manager,dc=nice,dc=com" -W -x -f user.ldif
ldapadd -D "cn=Manager,dc=nice,dc=com" -W -x -f group.ldif

step8. Test the LDAP config again.

ldapsearch -x -b "dc=nice,dc=com"

step9. Setup the PHP env (phpldapadmin)

yum install -y php php-ldap
tar phpldapadmin -C /var/www/html #Source code install phpldapadmin
cp /var/www/html/phpldapadmin/config/config.php.example /var/www/html/phpldapadmin/config/config.php

step10. Login phpldapadmin via web protal.

 http://localhost/phpldapadmin

step11. Create TLS(Transport Layer Security 安全传输协议) and check authentication certificate.

sh certcreate.sh #create certificate by certcreate.sh script

step12. Write TLS authentication certificate URL to the slap.conf.
vim /etc/openldap/slapd.conf

cp XXX.crt XXX.key /etc/openldap/certs
cp XXX.crt /var/www/html --> client can download the cert file

step13. Test the LDAP in clientPort.
Add LDAP domain by imaging and login the LDAP user.

step14. Setup the NFS
vim /etc/exports

/home    192.168.0.0/24(rw,sync)

Restart service

service nfs restart

step15. Setup the autofs
vim /etc/auto.master

/home    /etc/auto.ldap
cp /etc/auto.misc    /etc/auto.ldap

vim /etc/auto.ldap

*    -fstype==nfs,rw    LDAPServerIP:/home/&

Restart service

start autofs restart

step16. Test the LNA

su - LdapUserName
相关文章
|
1月前
|
Linux
Linux安装NFS挂载NFS卸载客户端服务端都有
Linux安装NFS挂载NFS卸载客户端服务端都有
57 0
|
1月前
|
Ubuntu 网络协议 Unix
【Linux】新唐NUC977挂载NFS实现网络文件传输
【Linux】新唐NUC977挂载NFS实现网络文件传输
|
1月前
|
Linux Shell Windows
通过Linux挂载Windows端NFS服务实现板端Linux传输文件到PC
通过Linux挂载Windows端NFS服务实现板端Linux传输文件到PC
186 0
|
1月前
|
存储 监控 网络协议
【Linux】文件服务NFS(Network File System)
【Linux】文件服务NFS(Network File System)
132 0
|
1月前
|
存储 Linux 网络安全
Linux系统安装NFS服务器
NFS是一种网络文件系统,英文全称Network File System,通过NFS可以让不同的主机系统之间共享文件或目录。通过NFS,用户可以直接在本地NFS客户端读写NFS服务端上的文件,是非常好的共享存储工具。本篇文章将介绍如何在CentOS7上安装NFS服务器,包括服务端和客户端安装两部分。
88 0
|
1月前
|
域名解析 Unix Linux
AIX上如何正确挂载Linux 的nfs共享目录分享篇
AIX上如何正确挂载Linux 的nfs共享目录分享篇
37 1
|
1月前
|
Unix Linux Shell
linux 配置NFS
NFS(Network File System)是跨平台的网络文件系统,允许不同操作系统和硬件通过RPC协议共享文件系统。服务端启动RPC服务和NFS,注册端口信息。客户端请求服务器的NFS端口,建立连接进行数据传输。优点包括配置简单、数据可靠、支持多系统间文件共享。缺点包括端口不固定、数据明文传输、安全性较低(基于IP认证)。在Redhat 9环境下,通过安装nfs-utils和rpcbind,配置共享目录和exports文件,设置权限,客户端安装相同软件包,使用showmount命令查看共享,挂载NFS目录,实现透明访问。
49 1
|
1月前
|
Linux 网络安全
Linux NFS协议详解
Linux NFS协议详解
137 5
|
1月前
|
存储 Linux
Linux Autofs自动挂载服务详解
Linux Autofs自动挂载服务详解
38 0
|
10月前
|
存储 网络协议 Linux
Linux/centos上如何配置管理NFS服务器?
Linux/centos上如何配置管理NFS服务器?
209 0