공부/리눅스 관련

LDAP 클라이언트 설정 ubuntu 22.04

inSaPPoRo 2022. 5. 13. 19:52

시작하면서

ubuntu에 ldap클라이언트를 설정하고 접속해보기로 한다.

인스톨

$ sudo apt -y install libnss-ldapd libpam-ldapd ldap-utils


  ┌────────────────────────────────┤ Configuring nslcd ├─────────────────────────────────┐
  │ Please enter the Uniform Resource Identifier of the LDAP server. The format is       │
  │ "ldap://<hostname_or_IP_address>:<port>/". Alternatively, "ldaps://" or "ldapi://"   │
  │ can be used. The port number is optional.                                            │
  │                                                                                      │
  │ When using an ldap or ldaps scheme it is recommended to use an IP address to avoid   │
  │ failures when domain name services are unavailable.                                  │
  │                                                                                      │
  │ Multiple URIs can be separated by spaces.                                            │
  │                                                                                      │
  │ LDAP server URI:                                                                     │
  │                                                                                      │
  │ ldap://127.0.0.1/___________________________________________________________________ │
  │                                                                                      │
  │                       <Ok>                           <Cancel>                        │
  │                                                                                      │
  └──────────────────────────────────────────────────────────────────────────────────────┘

LDAP server의 URI를 넣어 줍니다.

  ┌─────────────────────────────────┤ Configuring nslcd ├─────────────────────────────────┐
  │ Please enter the distinguished name of the LDAP search base. Many sites use the       │
  │ components of their domain names for this purpose. For example, the domain            │
  │ "example.net" would use "dc=example,dc=net" as the distinguished name of the search   │
  │ base.                                                                                 │
  │                                                                                       │
  │ LDAP server search base:                                                              │
  │                                                                                       │
  │ dc=flets-east,dc=jp__________________________________________________________________ │
  │                                                                                       │
  │                        <Ok>                            <Cancel>                       │
  │                                                                                       │
  └───────────────────────────────────────────────────────────────────────────────────────┘

베이스 조직명을 넣어줍니다.




  ┌─────────────────────────────┤ Configuring libnss-ldapd ├──────────────────────────────┐
  │ For this package to work, you need to modify the /etc/nsswitch.conf file to use the   │
  │ ldap datasource.                                                                      │
  │                                                                                       │
  │ You can select the services that should have LDAP lookups enabled. The new LDAP       │
  │ lookups will be added as the last datasource. Be sure to review these changes.        │
  │                                                                                       │
  │ Name services to configure:                                                           │
  │                                                                                       │
  │    [ ] passwd                                                                         │
  │    [ ] group                                                                          │
  │    [ ] shadow                                                                         │
  │    [ ] hosts                                                                          │
  │    [ ] networks                                                                       │
  │    [ ] ethers                                                                         │
  │    [ ] protocols                                                                      │
  │    [ ] services                                                                       │
  │    [ ] rpc                                                                            │
  │    [ ] netgroup                                                                       │
  │    [ ] aliases                                                                        │
  │                                                                                       │
  │                                                                                       │
  │                                        <Ok>                                           │
  │                                                                                       │
  └───────────────────────────────────────────────────────────────────────────────────────┘

passwd
group
shadow
위의 3곳에 체크를 넣어 줍니다.

설치가 끝났으면 로그인 하면 자동으로 홈 디렉토리를 생성하게 설정해줍니다.

$ sudo vi /etc/pam.d/common-session

## 가장 아랫줄에 아래 내용 추가
session optional        pam_mkhomedir.so skel=/etc/skel umask=077

설정이 끝났으니 ldap에 설정한 유저를 이용해서 로그인을 시도해 봅니다.
문제가 없이 로그인 되면 설정 완료.

반응형