Microsoft MVP성태의 닷넷 이야기
개발 환경 구성: 168. 우분투 서버 Active Directory 가입하기 [링크 복사], [링크+제목 복사],
조회: 22576
글쓴 사람
정성태 (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)
13507정성태1/2/20243154닷넷: 2191. C# - IPGlobalProperties를 이용해 netstat처럼 사용 중인 Socket 목록 구하는 방법파일 다운로드1
13506정성태12/29/20232669닷넷: 2190. C# - 닷넷 코어/5+에서 달라지는 System.Text.Encoding 지원
13505정성태12/27/20233276닷넷: 2189. C# - WebSocket 클라이언트를 닷넷으로 구현하는 예제 (System.Net.WebSockets)파일 다운로드1
13504정성태12/27/20232862닷넷: 2188. C# - ASP.NET Core SignalR로 구현하는 채팅 서비스 예제파일 다운로드1
13503정성태12/27/20232782Linux: 67. WSL 환경 + mlocate(locate) 도구의 /mnt 디렉터리 검색 문제
13502정성태12/26/20232770닷넷: 2187. C# - 다른 프로세스의 환경변수 읽는 예제파일 다운로드1
13501정성태12/25/20232599개발 환경 구성: 700. WSL + uwsgi - IPv6로 바인딩하는 방법
13500정성태12/24/20232736디버깅 기술: 194. Windbg - x64 가상 주소를 물리 주소로 변환
13498정성태12/23/20233517닷넷: 2186. 한국투자증권 KIS Developers OpenAPI의 C# 래퍼 버전 - eFriendOpenAPI NuGet 패키지
13497정성태12/22/20232739오류 유형: 885. Visual Studiio - error : Could not connect to the remote system. Please verify your connection settings, and that your machine is on the network and reachable.
13496정성태12/21/20232952Linux: 66. 리눅스 - 실행 중인 프로세스 내부의 환경변수 설정을 구하는 방법 (gdb)
13495정성태12/20/20232873Linux: 65. clang++로 공유 라이브러리의 -static 옵션 빌드가 가능할까요?
13494정성태12/20/20233024Linux: 64. Linux 응용 프로그램의 (C++) so 의존성 줄이기(ReleaseMinDependency) - 두 번째 이야기
13493정성태12/19/20233144닷넷: 2185. C# - object를 QueryString으로 직렬화하는 방법
13492정성태12/19/20232819개발 환경 구성: 699. WSL에 nopCommerce 예제 구성
13491정성태12/19/20232539Linux: 63. 리눅스 - 다중 그룹 또는 사용자를 리소스에 권한 부여
13490정성태12/19/20232668개발 환경 구성: 698. Golang - GLIBC 의존을 없애는 정적 빌드 방법
13489정성태12/19/20232446개발 환경 구성: 697. GoLand에서 ldflags 지정 방법
13488정성태12/18/20232390오류 유형: 884. HTTP 500.0 - 명령행에서 실행한 ASP.NET Core 응용 프로그램을 실행하는 방법
13487정성태12/16/20232707개발 환경 구성: 696. C# - 리눅스용 AOT 빌드를 docker에서 수행 [1]
13486정성태12/15/20232518개발 환경 구성: 695. Nuget config 파일에 값 설정/삭제 방법
13485정성태12/15/20232383오류 유형: 883. dotnet build/restore - error : Root element is missing
13484정성태12/14/20232579개발 환경 구성: 694. Windows 디렉터리 경로를 WSL의 /mnt 포맷으로 구하는 방법
13483정성태12/14/20232768닷넷: 2184. C# - 하나의 resource 파일을 여러 프로그램에서 (AOT 시에도) 사용하는 방법파일 다운로드1
13482정성태12/13/20233515닷넷: 2183. C# - eFriend Expert OCX 예제를 .NET Core/5+ Console App에서 사용하는 방법 [2]파일 다운로드1
13481정성태12/13/20232786개발 환경 구성: 693. msbuild - .NET Core/5+ 프로젝트에서 resgen을 이용한 리소스 파일 생성 방법파일 다운로드1
1  2  3  4  5  [6]  7  8  9  10  11  12  13  14  15  ...