怎么配置nss-pam-ldap

這篇文章主要介紹“怎么配置nss-pam-ldap”,在日常操作中,相信很多人在怎么配置nss-pam-ldap問題上存在疑惑,小編查閱了各式資料,整理出簡(jiǎn)單好用的操作方法,希望對(duì)大家解答”怎么配置nss-pam-ldap”的疑惑有所幫助!接下來(lái),請(qǐng)跟著小編一起來(lái)學(xué)習(xí)吧!

成都創(chuàng)新互聯(lián)公司是一家集網(wǎng)站建設(shè),尼開遠(yuǎn)企業(yè)網(wǎng)站建設(shè),尼開遠(yuǎn)品牌網(wǎng)站建設(shè),網(wǎng)站定制,尼開遠(yuǎn)網(wǎng)站建設(shè)報(bào)價(jià),網(wǎng)絡(luò)營(yíng)銷,網(wǎng)絡(luò)優(yōu)化,尼開遠(yuǎn)網(wǎng)站推廣為一體的創(chuàng)新建站企業(yè),幫助傳統(tǒng)企業(yè)提升企業(yè)形象加強(qiáng)企業(yè)競(jìng)爭(zhēng)力??沙浞譂M足這一群體相比中小企業(yè)更為豐富、高端、多元的互聯(lián)網(wǎng)需求。同時(shí)我們時(shí)刻保持專業(yè)、時(shí)尚、前沿,時(shí)刻以成就客戶成長(zhǎng)自我,堅(jiān)持不斷學(xué)習(xí)、思考、沉淀、凈化自己,讓我們?yōu)楦嗟钠髽I(yè)打造出實(shí)用型網(wǎng)站。

一、Centos7.repo/epel.repo 安裝

rpm -Uvh http://mirror.centos.org/centos/7/os/x86_64/Packages/centos-release-7-6.1810.2.el7.centos.x86_64.rpm

yum install epel-release*

二、nss-pam-ldap/openldap-clients安裝

yum install nss-pam-ldap* openldap-clients*

三、nss-pam-ldap配置

配置openldap-clients

### backup
$ cp /etc/openldap/ldap.conf /etc/openldap/ldap.conf.`date +%F`


## 指向?qū)嶋H的OpenLdap-Server
$ vi /etc/openldap/ldap.conf
...

BASE    dc=example,dc=com
URI     ldap://ldap.example.com:389

...


## 校驗(yàn)openldap-clients是可用
$ ldapsearch -x -b 'dc=example,dc=com'
$ vim /etc/ssh/sshd_config
...
UsePAM yes
...

配置 /etc/sysconfig/authconfig

$ vi /etc/sysconf/authconfig

...
USELDAP=yes
USELDAPAUTH=yes
USESHADOW=yes
USESYSNETAUTH=yes
USEMKHOMEDIR=yes

...

配置 /etc/nsswith.conf

$ vi /etc/nsswitch.conf

...
passwd:     files sss ldap
shadow:     files sss ldap
group:      files sss ldap
...

配置 /etc/pam.d/system-auth

$ vi /etc/pam.d/system-auth

#%PAM-1.0
# This file is auto-generated.
# User changes will be destroyed the next time authconfig is run.
auth        required      pam_env.so
auth        required      pam_faildelay.so delay=2000000
auth        required      pam_faillock.so preauth silent audit deny=5 unlock_time=900
auth        sufficient    pam_unix.so try_first_pass
auth        requisite     pam_succeed_if.so uid >= 1000 quiet_success
auth        sufficient    pam_ldap.so use_first_pass
auth        required      pam_faillock.so authfail audit deny=5 unlock_time=900
auth        required      pam_deny.so

account     required      pam_faillock.so
account     required      pam_unix.so broken_shadow
account     sufficient    pam_localuser.so
account     sufficient    pam_succeed_if.so uid < 1000 quiet
account     [default=bad success=ok user_unknown=ignore] pam_ldap.so
account     required      pam_permit.so

password    requisite     pam_pwquality.so try_first_pass local_users_only retry=3 authtok_type=
password    sufficient    pam_unix.so md5 shadow try_first_pass use_authtok
password    sufficient    pam_ldap.so use_authtok
password    required      pam_deny.so

session     optional      pam_keyinit.so revoke
session     required      pam_limits.so
-session     optional      pam_systemd.so
session     optional      pam_mkhomedir.so umask=0077
session     [success=1 default=ignore] pam_succeed_if.so service in crond quiet use_uid
session     required      pam_unix.so
session     optional      pam_ldap.so
~

authconfigure-tui

  • Use LDAP

  • Use MD5 Passwords

  • Use Shadow Passwords

  • Use LDAP Authentication

  • Local authorization is sufficient

## 或者使用命令執(zhí)行

authconfig --enableldap --enableldapauth --ldapserver=127.0.01 --ldapbasedn="dc=example,dc=com" --enablemkhomedir --update --enablemd5 --enableshadow

驗(yàn)證

getent passwd

su - ${username}

ssh ${username}@${host}

四、限制用戶、用戶組ssh登錄

$ vi /etc/nslcd.conf

...
# The distinguished name of the search base.
# 只有該OU下的,才可能可以登錄
base ou=Employees,ou=Pano Users,dc=pano,dc=com
...

五、

id: cannot find name for group ID 1000

https://www.lisenet.com/2016/setup-ldap-authentication-on-centos-7/

vi /etc/nslcd.conf
...
uid nslcd
gid ldap

base ou=Users,dc=harry,dc=com

## 只需要該OU下的group
base group ou=Groups,dc=harry,dc=com

...



## 進(jìn)一步限制OU下的某些group
...
#filter passwd (memberof=cn=g1,ou=Groups,dc=harry,dc=com)

#filter passwd (!memberof=cn=g1,ou=Groups,dc=harry,dc=com)
...

到此,關(guān)于“怎么配置nss-pam-ldap”的學(xué)習(xí)就結(jié)束了,希望能夠解決大家的疑惑。理論與實(shí)踐的搭配能更好的幫助大家學(xué)習(xí),快去試試吧!若想繼續(xù)學(xué)習(xí)更多相關(guān)知識(shí),請(qǐng)繼續(xù)關(guān)注創(chuàng)新互聯(lián)網(wǎng)站,小編會(huì)繼續(xù)努力為大家?guī)?lái)更多實(shí)用的文章!

本文標(biāo)題:怎么配置nss-pam-ldap
當(dāng)前網(wǎng)址:http://muchs.cn/article44/ihchee.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站內(nèi)鏈、品牌網(wǎng)站制作、手機(jī)網(wǎng)站建設(shè)、虛擬主機(jī)、網(wǎng)站收錄小程序開發(fā)

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

成都網(wǎng)站建設(shè)