Microsoft MVP성태의 닷넷 이야기
개발 환경 구성: 168. 우분투 서버 Active Directory 가입하기 [링크 복사], [링크+제목 복사],
조회: 22587
글쓴 사람
정성태 (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

비밀번호

댓글 작성자
 




... [16]  17  18  19  20  21  22  23  24  25  26  27  28  29  30  ...
NoWriterDateCnt.TitleFile(s)
13253정성태2/9/20235588Windows: 222. C# - 다른 윈도우 프로그램이 실행되었음을 인식하는 방법파일 다운로드1
13252정성태2/9/20234394오류 유형: 844. ssh로 명령어 수행 시 멈춤 현상
13251정성태2/8/20234760스크립트: 44. 파이썬의 3가지 스레드 ID
13250정성태2/8/20236646오류 유형: 843. System.InvalidOperationException - Unable to configure HTTPS endpoint
13249정성태2/7/20235491오류 유형: 842. 리눅스 - You must wait longer to change your password
13248정성태2/7/20234385오류 유형: 841. 리눅스 - [사용자 계정] is not in the sudoers file. This incident will be reported.
13247정성태2/7/20235309VS.NET IDE: 180. Visual Studio - 닷넷 소스 코드 디버깅 중 "Decompile source code"가 동작하는 않는 문제
13246정성태2/6/20234507개발 환경 구성: 664. Hyper-V에 설치한 리눅스 VM의 VHD 크기 늘리는 방법 - 두 번째 이야기
13245정성태2/6/20235089.NET Framework: 2093. C# - PEM 파일을 이용한 RSA 개인키/공개키 설정 방법파일 다운로드1
13244정성태2/5/20234483VS.NET IDE: 179. Visual Studio - External Tools에 Shell 내장 명령어 등록
13243정성태2/5/20235309디버깅 기술: 190. windbg - Win32 API 호출 시점에 BP 거는 방법 [1]
13242정성태2/4/20234745디버깅 기술: 189. ASP.NET Web Application (.NET Framework) 프로젝트의 숨겨진 예외 - System.UnauthorizedAccessException
13241정성태2/3/20234142디버깅 기술: 188. ASP.NET Web Application (.NET Framework) 프로젝트의 숨겨진 예외 - System.IO.FileNotFoundException
13240정성태2/1/20234313디버깅 기술: 187. ASP.NET Web Application (.NET Framework) 프로젝트의 숨겨진 예외 - System.Web.HttpException
13239정성태2/1/20234018디버깅 기술: 186. C# - CacheDependency의 숨겨진 예외 - System.Web.HttpException
13238정성태1/31/20236173.NET Framework: 2092. IIS 웹 사이트를 TLS 1.2 또는 TLS 1.3 프로토콜로만 운영하는 방법
13237정성태1/30/20235855.NET Framework: 2091. C# - 웹 사이트가 어떤 버전의 TLS/SSL을 지원하는지 확인하는 방법
13236정성태1/29/20235288개발 환경 구성: 663. openssl을 이용해 인트라넷 IIS 사이트의 SSL 인증서 생성
13235정성태1/29/20234987개발 환경 구성: 662. openssl - 윈도우 환경의 명령행에서 SAN 적용하는 방법
13234정성태1/28/20236081개발 환경 구성: 661. dnSpy를 이용해 소스 코드가 없는 .NET 어셈블리의 코드를 변경하는 방법 [1]
13233정성태1/28/20237430오류 유형: 840. C# - WebClient로 https 호출 시 "The request was aborted: Could not create SSL/TLS secure channel" 예외 발생
13232정성태1/27/20235039스크립트: 43. uwsgi의 --processes와 --threads 옵션
13231정성태1/27/20234120오류 유형: 839. python - TypeError: '...' object is not callable
13230정성태1/26/20234509개발 환경 구성: 660. WSL 2 내부로부터 호스트 측의 네트워크로 UDP 데이터가 1개의 패킷으로만 제한되는 문제
13229정성태1/25/20235559.NET Framework: 2090. C# - UDP Datagram의 최대 크기
13228정성태1/24/20235671.NET Framework: 2089. C# - WMI 논리 디스크가 속한 물리 디스크의 정보를 얻는 방법 [2]파일 다운로드1
... [16]  17  18  19  20  21  22  23  24  25  26  27  28  29  30  ...