Microsoft MVP성태의 닷넷 이야기
개발 환경 구성: 168. 우분투 서버 Active Directory 가입하기 [링크 복사], [링크+제목 복사],
조회: 22341
글쓴 사람
정성태 (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)
13619정성태5/7/2024282닷넷: 2259. C# - decimal 저장소의 비트 구조파일 다운로드1
13618정성태5/6/2024472닷넷: 2258. C# - double (배정도 실수) 저장소의 비트 구조파일 다운로드1
13617정성태5/5/2024480닷넷: 2257. C# - float (단정도 실수) 저장소의 비트 구조파일 다운로드1
13616정성태5/3/2024601닷넷: 2256. ASP.NET Core 웹 사이트의 HTTP/HTTPS + Dual mode Socket (IPv4/IPv6) 지원 방법파일 다운로드1
13615정성태5/3/2024690닷넷: 2255. C# 배열을 Numpy ndarray 배열과 상호 변환
13614정성태5/2/2024797닷넷: 2254. C# - COM 인터페이스의 상속 시 중복으로 메서드를 선언
13613정성태5/1/2024841닷넷: 2253. C# - Video Capture 장치(Camera) 열거 및 지원 포맷 조회파일 다운로드1
13612정성태4/30/2024827오류 유형: 902. Visual Studio - error MSB3021: Unable to copy file
13611정성태4/29/2024877닷넷: 2252. C# - GUID 타입 전용의 UnmanagedType.LPStruct - 두 번째 이야기파일 다운로드1
13610정성태4/28/2024933닷넷: 2251. C# - 제네릭 인자를 가진 타입을 생성하는 방법 - 두 번째 이야기
13609정성태4/27/2024989닷넷: 2250. PInvoke 호출 시 참조 타입(class)을 마샬링하는 [IN], [OUT] 특성파일 다운로드1
13608정성태4/26/20241069닷넷: 2249. C# - 부모의 필드/프로퍼티에 대해 서로 다른 자식 클래스 간에 Reflection 접근이 동작할까요?파일 다운로드1
13607정성태4/25/20241083닷넷: 2248. C# - 인터페이스 타입의 다중 포인터를 인자로 갖는 C/C++ 함수 연동
13606정성태4/24/20241032닷넷: 2247. C# - tensorflow 연동 (MNIST 예제)파일 다운로드1
13605정성태4/23/20241023닷넷: 2246. C# - Python.NET을 이용한 파이썬 소스코드 연동파일 다운로드1
13604정성태4/22/20241027오류 유형: 901. Visual Studio - Unable to set the next statement. Set next statement cannot be used in '[Exception]' call stack frames.
13603정성태4/21/20241082닷넷: 2245. C# - IronPython을 이용한 파이썬 소스코드 연동파일 다운로드1
13602정성태4/20/20241037닷넷: 2244. C# - PCM 오디오 데이터를 연속(Streaming) 재생 (Windows Multimedia)파일 다운로드1
13601정성태4/19/20241059닷넷: 2243. C# - PCM 사운드 재생(NAudio)파일 다운로드1
13600정성태4/18/20241108닷넷: 2242. C# - 관리 스레드와 비관리 스레드
13599정성태4/17/20241014닷넷: 2241. C# - WAV 파일의 PCM 사운드 재생(Windows Multimedia)파일 다운로드1
13598정성태4/16/20241057닷넷: 2240. C# - WAV 파일 포맷 + LIST 헤더파일 다운로드2
13597정성태4/15/20241089닷넷: 2239. C# - WAV 파일의 PCM 데이터 생성 및 출력파일 다운로드1
13596정성태4/14/20241160닷넷: 2238. C# - WAV 기본 파일 포맷파일 다운로드1
13595정성태4/13/20241112닷넷: 2237. C# - Audio 장치 열기 (Windows Multimedia, NAudio)파일 다운로드1
[1]  2  3  4  5  6  7  8  9  10  11  12  13  14  15  ...