Microsoft MVP성태의 닷넷 이야기
개발 환경 구성: 168. 우분투 서버 Active Directory 가입하기 [링크 복사], [링크+제목 복사],
조회: 22578
글쓴 사람
정성태 (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)
13481정성태12/13/20232786개발 환경 구성: 693. msbuild - .NET Core/5+ 프로젝트에서 resgen을 이용한 리소스 파일 생성 방법파일 다운로드1
13480정성태12/12/20233172개발 환경 구성: 692. Windows WSL 2 + Chrome 웹 브라우저 설치
13479정성태12/11/20232684개발 환경 구성: 691. WSL 2 (Ubuntu) + nginx 환경 설정
13477정성태12/8/20232935닷넷: 2182. C# - .NET 7부터 추가된 Int128, UInt128 [1]파일 다운로드1
13476정성태12/8/20232770닷넷: 2181. C# - .NET 8 JsonStringEnumConverter의 AOT를 위한 개선파일 다운로드1
13475정성태12/7/20232800닷넷: 2180. .NET 8 - 함수 포인터에 대한 Reflection 정보 조회파일 다운로드1
13474정성태12/6/20232651개발 환경 구성: 690. 닷넷 코어/5+ 버전의 ilasm/ildasm 실행 파일 구하는 방법 - 두 번째 이야기
13473정성태12/5/20232907닷넷: 2179. C# - 값 형식(Blittable)을 메모리 복사를 이용해 바이트 배열로 직렬화/역직렬화파일 다운로드1
13472정성태12/4/20232571C/C++: 164. Visual C++ - InterlockedCompareExchange128 사용 방법
13471정성태12/4/20232757Copilot - To enable GitHub Copilot, authorize this extension using GitHub's device flow
13470정성태12/2/20232879닷넷: 2178. C# - .NET 8부터 COM Interop에 대한 자동 소스 코드 생성 도입파일 다운로드1
13469정성태12/1/20232774닷넷: 2177. C# - (Interop DLL 없이) CoClass를 이용한 COM 개체 생성 방법파일 다운로드1
13468정성태12/1/20232538닷넷: 2176. C# - .NET Core/5+부터 달라진 RCW(Runtime Callable Wrapper) 대응 방식파일 다운로드1
13467정성태11/30/20232813오류 유형: 882. C# - Unhandled exception. System.Runtime.InteropServices.COMException (0x800080A5)파일 다운로드1
13466정성태11/29/20232935닷넷: 2175. C# - DllImport 메서드의 AOT 지원을 위한 LibraryImport 옵션
13465정성태11/28/20232718개발 환경 구성: 689. MSBuild - CopyToOutputDirectory가 "dotnet publish" 시에는 적용되지 않는 문제파일 다운로드1
13464정성태11/28/20232742닷넷: 2174. C# - .NET 7부터 UnmanagedCallersOnly 함수 export 기능을 AOT 빌드에 통합파일 다운로드1
13463정성태11/27/20232636오류 유형: 881. Visual Studio - NU1605: Warning As Error: Detected package downgrade
13462정성태11/27/20232668오류 유형: 880. Visual Studio - error CS0246: The type or namespace name '...' could not be found
13461정성태11/26/20232695닷넷: 2173. .NET Core 3/5+ 기반의 COM Server를 registry 등록 없이 사용하는 방법파일 다운로드1
13460정성태11/26/20232780닷넷: 2172. .NET 6+ 기반의 COM Server 내에 Type Library를 내장하는 방법파일 다운로드1
13459정성태11/26/20232728닷넷: 2171. .NET Core 3/5+ 기반의 COM Server를 기존의 regasm처럼 등록하는 방법파일 다운로드1
13458정성태11/26/20232733닷넷: 2170. .NET Core/5+ 기반의 COM Server를 tlb 파일을 생성하는 방법(tlbexp)
13457정성태11/25/20232726VS.NET IDE: 187. Visual Studio - 16.9 버전부터 추가된 "Display inline type hints" 옵션
13456정성태11/25/20233014닷넷: 2169. C# - OpenAI를 사용해 PDF 데이터를 대상으로 OpenAI 챗봇 작성 [1]파일 다운로드1
13455정성태11/25/20232892닷넷: 2168. C# - Azure.AI.OpenAI 패키지로 OpenAI 사용파일 다운로드1
1  2  3  4  5  6  [7]  8  9  10  11  12  13  14  15  ...