Microsoft MVP성태의 닷넷 이야기
개발 환경 구성: 168. 우분투 서버 Active Directory 가입하기 [링크 복사], [링크+제목 복사],
조회: 22573
글쓴 사람
정성태 (techsharer at outlook.com)
홈페이지
첨부 파일
 
(연관된 글이 2개 있습니다.)

우분투 서버 Active Directory 가입하기

Active Directory(뿐만 아니라 그 외의 인증 서버)를 한번 사용하기 시작하면 그 편리함에 반할 수밖에 없지요. ^^ 요즘처럼 수많은 VM을 설치하는 시기에는 AD없이 관리한다는 것은 상상도 못합니다.

최근 들어, 저 개인적으로도 리눅스 지식을 습득해야겠다는 필요성이 들어서 전에 비해서는 부쩍(?) 우분투를 사용할 일이 생겼는데요. 그러다 보니 이것마저 AD 가입을 시키면 좋겠다 싶어서 한번 실습을 해봤습니다.

우선, 방법은 다음의 글을 보고 참조했는데요.

크로스 플랫폼 개발 환경 만들기 - (6/11) 윈도우 Active Directory 가입
; http://devwith.com/?r=home&m=bbs&bid=teamblog_net&uid=2136

따라해 보니, 제 상황에서는 약간 다른 면이 있어서 기록으로 남겨둡니다.

일단, likewise-open 설치부터 걸렸습니다. 다음과 같이 명령을 내렸는데,

sudo apt-get install likewise-open 

진행하다가 마지막 "Importing registry..." 메시지를 끝으로 설치가 멈춰버리는 현상이 발생했습니다. 검색해 보니 다음의 글이 나오는데요.

package likewise-open 6.1.0.406-0ubuntu5 failed to install/upgrade: subprocess installed post-installation script returned error exit status 1 
; https://bugs.launchpad.net/ubuntu/+source/likewise-open/+bug/987574

즉, winbind와 충돌이 일어난다는 내용이고, 그래서 아래의 명령으로 삭제를 한 후,

sudo apt-get remove winbind

다시 설치를 해서 성공을 했습니다. ^^

root@ubuntux64:~# sudo apt-get install likewise-open
Reading package lists... Done
Building dependency tree
Reading state information... Done
Suggested packages:
  likewise-open-gui
The following NEW packages will be installed:
  likewise-open
0 upgraded, 1 newly installed, 0 to remove and 42 not upgraded.
Need to get 0 B/3,208 kB of archives.
After this operation, 9,118 kB of additional disk space will be used.
Selecting previously unselected package likewise-open.
(Reading database ... 126361 files and directories currently installed.)
Unpacking likewise-open (from .../likewise-open_6.1.0.406-0ubuntu5_amd64.deb) ..        .
Processing triggers for ureadahead ...
Processing triggers for man-db ...
Setting up likewise-open (6.1.0.406-0ubuntu5) ...
Importing registry...

root@ubuntux64:~#

이제 AD에 리눅스를 가입시켜야 하는데요. 구성한 Active Directory의 FQDN이 공용 DNS에 등록된 이름과 같다면 상관없지만, 다른 경우에는 사내 DNS 서버를 리눅스에 알려줘야 합니다. 안 그러면 다음과 같이 오류 발생할 수 있습니다.

root@ubuntux64:~# sudo domainjoin-cli join testad.com "Kevin Jeong"
Joining to AD Domain:   testad.com
With Computer DNS Name: ubuntux64.testad.com

Kevin Jeong@TESTAD.COM's password:

Error: DNS_ERROR_BAD_PACKET [code 0x0000251e]

A bad packet was received from a DNS server. Potentially the requested address does not exist.

이를 위해 윈도우의 hosts 파일에 해당하는 resolv.conf에 사내 DNS 서버를 등록 줍니다. 이때 vi 에디터를 사용해도 되지만, 저처럼 리눅스 초보자에게는 nano 에디터를 사용하는 것도 좋은 선택입니다. ^^

root@ubuntux64:~# sudo nano /etc/resolv.conf

제 경우에는 다음과 같이 편집을 했습니다.

root@ubuntux64:~# cat /etc/resolv.conf
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
# nameserver 168.126.63.1
# nameserver 168.126.63.2
nameserver 192.168.1.190
nameserver 192.168.1.186

이제, 다시 도메인 가입을 하면 정상적으로 완료됩니다.

root@ubuntux64:~# sudo domainjoin-cli join testad.com "Kevin Jeong"
Joining to AD Domain:   testad.com
With Computer DNS Name: ubuntux64.testad.com

Kevin Jeong@TESTAD.COM's password:
SUCCESS
You should reboot this system before attempting GUI logins as a domain user.
root@ubuntux64:~#

그다음, likewise 서비스를 시작해 둡니다.

root@ubuntux64:~# sudo /etc/init.d/likewise start
 * Starting Likewise Open services       [ OK ]

"크로스 플랫폼 개발 환경 만들기 - (6/11) 윈도우 Active Directory 가입" 글에서는 관리자 권한을 주기 위해 admin(또는 administrator) 그룹에 넣는다고 하면서 명령을 실행하고 있는데요. 제가 해보니 그 과정이 필요치는 않았습니다.

그다음 sudoers 파일을 편집할 차례인데요.

sudo nano /etc/sudoers

역시 "크로스 플랫폼 개발 환경 만들기 - (6/11) 윈도우 Active Directory 가입" 글에서는 많은 항목을 추가하고 있지만 직접 해보니 하나만 넣어도 무방했습니다. 아래는 제가 넣은 Active Directory의 사용자 계정입니다.

...[생략]...

# User privilege specification
root    ALL=(ALL:ALL) ALL
TESTAD\\kevin^jeong ALL=(ALL:ALL) ALL

...[생략]...

변경시 주의할 점이 있습니다. 바로 Active Directory 이름을 반드시 대문자 (예: TESTAD)로 해야 한다는 것. 그리고 계정에 공백이 들어가면 "^"로 표현해 주면 됩니다. (리눅스 계열에서는 공백을 '^'문자로 표현하는 관례가 있는 것 같습니다.)

이렇게 항목을 추가했으면 변경된 sudoers 파일을 시스템에 반영하기 위해 credentials 캐시 정보를 비워주어야 하는데요. 이를 위해 다음과 같이 명령을 내리면 됩니다.

sudo -k

마지막으로, 테스트를 위해 콘솔 창에서 로그인 시도를 하면 끝! ^^

Ubuntu 12.04 LTS ubuntux64 tty1
ubuntux64 login: testad\kevin jeong
Password:
Added user TESTAD\kevin^jeong.

Welcome to ...

로그인 후, /etc/sudoers 파일 변경을 올바르게 했는지 확인하기 위해 sudo 권한으로 접근해 보면 됩니다.

sudo -s




부가적으로, likewise의 도구에 대한 설명을 찾아보았는데 다음의 글이 검색되었습니다.

How to configure Likewise "Open" AD intergration on vMA 
; http://www.virtuallyghetto.com/2010/06/how-to-configure-likewise-open-ad.html

위의 글이 씌여진 시점이 2010년인데, 그사이 많은 변화가 있었나봅니다.

도구가 놓여진 폴더가 "/opt/likewise/bin"라고 하는데, 실제로는 /usr/bin 폴더에 lw로 시작하는 파일들로 있었습니다.

root@ubuntux64:/usr/bin# ls lw*
lw-ad-cache            lw-find-objects          lw-lsa
lw-addevent            lw-find-user-by-id       lwma
lw-add-group           lw-find-user-by-name     lw-mod-group
lw-add-user            lw-get-dc-list           lw-mod-user
lwconfig               lw-get-dc-name           lwnet-get-log-info
lw-del-group           lw-get-dc-time           lwnet-set-log-level
lw-del-user            lw-get-log-info          lw-query-member-of
lw-edit-reg            lw-get-metrics           lw-refresh-configuration
lw-enum-groups         lw-get-status            lwregshell
lw-enum-members        lwio-cli                 lw-set-default-domain
lw-enum-objects        lwio-copy                lw-set-log-level
lw-enum-users          lwio-driver              lw-set-machine-name
lw-eventlog-cli        lwio-get-log-info        lw-set-machine-sid
lw-export-dc-cache     lwio-refresh             lwsm
lw-find-by-sid         lwio-set-log-info        lw-update-dns
lw-find-group-by-id    lwio-tool                lw-ypcat
lw-find-group-by-name  lw-list-groups-for-user  lw-ypmatch

만약, 캐시된 사용자 정보를 clear하고 싶다면 "lw-ad-cache --delete-all" 명령을 내려주면 됩니다. ^^

root@ubuntux64:/usr/bin# lw-ad-cache
Usage: lw-ad-cache --delete-all [--domain domain]
       lw-ad-cache --delete-user [--domain domain] {--name <user login id> | --uid <uid>}
       lw-ad-cache --delete-group [--domain domain] {--name <group name> | --gid <gid>}
       lw-ad-cache --enum-users [--domain domain] {--batchsize [1..1000]}
       lw-ad-cache --enum-groups [--domain domain] {--batchsize [1..1000]}

        --delete-all        Deletes everything from the cache
        --delete-user       Deletes one user from the cache
        --delete-group      Deletes one group from the cache
        --enum-users        Enumerates users in the cache
        --enum-groups       Enumerates groups in the cache

root@ubuntux64:/usr/bin# lw-ad-cache --delete-all
The cache has been emptied successfully.
root@ubuntux64:/usr/bin#

리눅스는 윈도우 개발자에게도 또 다른 가능성의 영역으로 보입니다. ^^




[이 글에 대해서 여러분들과 의견을 공유하고 싶습니다. 틀리거나 미흡한 부분 또는 의문 사항이 있으시면 언제든 댓글 남겨주십시오.]

[연관 글]






[최초 등록일: ]
[최종 수정일: 6/27/2021]

Creative Commons License
이 저작물은 크리에이티브 커먼즈 코리아 저작자표시-비영리-변경금지 2.0 대한민국 라이센스에 따라 이용하실 수 있습니다.
by SeongTae Jeong, mailto:techsharer at outlook.com

비밀번호

댓글 작성자
 




1  2  3  4  5  6  7  8  [9]  10  11  12  13  14  15  ...
NoWriterDateCnt.TitleFile(s)
13430정성태10/30/20233049닷넷: 2153. C# - 사용자가 빌드한 ICU dll 파일을 사용하는 방법
13429정성태10/27/20233253닷넷: 2152. Win32 Interop - C/C++ DLL로부터 이중 포인터 버퍼를 C#으로 받는 예제파일 다운로드1
13428정성태10/25/20233418닷넷: 2151. C# 12 - ref readonly 매개변수
13427정성태10/18/20233603닷넷: 2150. C# 12 - 정적 문맥에서 인스턴스 멤버에 대한 nameof 접근 허용(Allow nameof to always access instance members from static context)
13426정성태10/13/20233681스크립트: 59. 파이썬 - 비동기 호출 함수(run_until_complete, run_in_executor, create_task, run_in_threadpool)
13425정성태10/11/20233486닷넷: 2149. C# - PLinq의 Partitioner<T>를 이용한 사용자 정의 분할파일 다운로드1
13423정성태10/6/20233502스크립트: 58. 파이썬 - async/await 기본 사용법
13422정성태10/5/20233597닷넷: 2148. C# - async 유무에 따른 awaitable 메서드의 병렬 및 예외 처리
13421정성태10/4/20233694닷넷: 2147. C# - 비동기 메서드의 async 예약어 유무에 따른 차이
13420정성태9/26/20236279스크립트: 57. 파이썬 - UnboundLocalError: cannot access local variable '...' where it is not associated with a value
13419정성태9/25/20233421스크립트: 56. 파이썬 - RuntimeError: dictionary changed size during iteration
13418정성태9/25/20234300닷넷: 2146. C# - ConcurrentDictionary 자료 구조의 동기화 방식
13417정성태9/19/20233774닷넷: 2145. C# - 제네릭의 형식 매개변수에 속한 (매개변수를 가진) 생성자를 호출하는 방법
13416정성태9/19/20233468오류 유형: 877. redis-py - MISCONF Redis is configured to save RDB snapshots, ...
13415정성태9/18/20233955닷넷: 2144. C# 12 - 컬렉션 식(Collection Expressions)
13414정성태9/16/20233829디버깅 기술: 193. Windbg - ThreadStatic 필드 값을 조사하는 방법
13413정성태9/14/20234006닷넷: 2143. C# - 시스템 Time Zone 변경 시 이벤트 알림을 받는 방법
13412정성태9/14/20237354닷넷: 2142. C# 12 - 인라인 배열(Inline Arrays) [1]
13411정성태9/12/20233817Windows: 252. 권한 상승 전/후 따로 관리되는 공유 네트워크 드라이브 정보
13410정성태9/11/20235404닷넷: 2141. C# 12 - Interceptor (컴파일 시에 메서드 호출 재작성) [1]
13409정성태9/8/20234161닷넷: 2140. C# - Win32 API를 이용한 모니터 전원 끄기
13408정성태9/5/20234159Windows: 251. 임의로 만든 EXE 파일을 포함한 ZIP 파일의 압축을 해제할 때 Windows Defender에 의해 삭제되는 경우
13407정성태9/4/20233869닷넷: 2139. C# - ParallelEnumerable을 이용한 IEnumerable에 대한 병렬 처리
13406정성태9/4/20233896VS.NET IDE: 186. Visual Studio Community 버전의 라이선스
13405정성태9/3/20234312닷넷: 2138. C# - async 메서드 호출 원칙
13404정성태8/29/20233836오류 유형: 876. Windows - 키보드의 등호(=, Equals sign) 키가 눌리지 않는 경우
1  2  3  4  5  6  7  8  [9]  10  11  12  13  14  15  ...