linux ldap客户端配置文件,ldap linux client详细配置

一、用setup安装最简单

yum install nss-pam-ldapd

p_w_picpath2012-11-12+17%3A58%3A9.png?version=1&modificationDate=1352714290100

p_w_picpath2012-11-12+17%3A59%3A1.png?version=1&modificationDate=1352714341260

p_w_picpath2012-11-12+17%3A59%3A57.png?version=1&modificationDate=1352714397818

[root@sgnbj-192-168-1-99 ~]# cat /etc/passwd|grep test

[root@sgnbj-192-168-1-99 ~]# id test

uid=10000(test) gid=10001 groups=10001  ##成功了

或如下修改客户端

1、

yum install openldap-clients

yum install nss-pam-ldapd

开启nslcd服务

vim /etc/nslcd.conf

uid nslcd

gid ldap

# This comment prevents repeated auto-migration of settings.

uri   ldap://192.168.10.70/

base  dc=example,dc=com

ssl no

/etc/init.d/nslcd start

2、  AUTH

用来跟踪特定身份验证机制是否已经启用的文件是 /etc/sysconfig/authconfig  我们可以希望以下条目的值都是 “yes”:

USELDAP=yes

USELDAPAUTH=yes

PASSWDALGORITHM=md5

USESHADOW=yes

USELOCAUTHORIZE=yes

3、

PAM 和 NSS 模块使用的基本配置文件是 /etc/openldap/ldap.conf。host 选项指定 LDAP 服务器,base 选项指定这个目录使用的 DN,最初

我们希望关闭加密功能:

URI ldap://192.168.10.70/

BASE dc=example,dc=com

TLS_CACERTDIR /etc/openldap/certs

4.  NSS

要让 NSS 服务使用 OpenLDAP 服务器,需要将 “ldap” 添加到 /etc/nsswitch.conf 文件的 passwd、shadow 和 group 行中,如下所示:

passwd: files ldap

shadow: files ldap

group: files ldap

5.  PAM

/etc/pam.d/system-auth 添加

auth        sufficient    pam_ldap.so use_first_pass

account     [default=bad success=ok user_unknown=ignore] pam_ldap.so

password    sufficient    pam_ldap.so use_authtok

session     optional      pam_ldap.so

二、限制非linux帐号登录

vim /etc/pam_ldap.conf

pam_min_uid 500

pam_max_uid 6000

##设置认证登录的uid范围,防止非法登录 如:若account的uid=0的话 就有root权限, 提高安全性 (可以在ldap上设置linux帐号为这段uid)

e.g:

[root@175 ~]# id test

uid=10000(test) gid=10001 groups=10001

[root@www ~]# ssh test@192.168.10.175

test@192.168.10.175's password:

UID must be less than 6000

Connection closed by 192.168.10.175

三、 设置登录用户的家目录

默认设置登录一个linux系统没有的帐号,不会创建该帐号的家目录

[root@www ~]# ssh test@192.168.10.175

test@192.168.10.175's password:

Last login: Mon Nov 12 17:43:06 2012 from 192.168.10.70

Could not chdir to home directory /home/test: No such file or directory

-bash-4.1$ pwd

/

修改配置:

vim /etc/pam.d/sshd   添加

session required        pam_mkhomedir.so skel=/etc/skel/ umask=0077

测试:

e.g:

[root@sgnbj-192-168-1-99 home]# ls

svn

[root@www ~]# ssh test@192.168.10.175

test@192.168.10.175's password:

Creating directory '/home/test'.

Last login: Mon Nov 12 18:47:52 2012 from 192.168.10.70

[test@sgnbj-192-168-1-99 ~]$ pwd

/home/test

[test@sgnbj-192-168-1-99 ~]$ ls /home/

svn  test

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值