Share Your AWS re:Post Experience - Quick 3 Question Survey and Earn a re:Post Badge
Help us improve AWS re:Post! We're interested in understanding how you use re:Post and its impact on your AWS journey. Please take a moment to complete our brief 3-question survey
EC2 Mac 인스턴스의 암호를 재설정하려면 어떻게 해야 합니까?
Amazon Elastic Compute Cloud(Amazon EC2) Mac 인스턴스의 암호를 몰라서 암호를 재설정해야 합니다. 또는 ec2-user의 암호를 재설정해야 합니다.
간략한 설명
EC2 Mac 인스턴스 사용자가 보안 토큰을 사용하는 ec2-user의 암호를 모르는 경우 문제가 발생할 수 있습니다. 보안 토큰이 있는 다른 사용자가 잊어버린 암호를 재설정하려면 사용자 역시 보안 토큰을 보유해야 합니다.
EC2 Mac 인스턴스에서 첫 번째 사용자 암호를 설정하면 기본적으로 보안 토큰이 해당 사용자에게 발급됩니다. ec2-user 사용자의 보안 토큰을 발급하려면 먼저 ec2-user의 암호를 설정해야 합니다. 자세한 내용은 Apple 웹사이트에서 배포 시 보안 토큰, 부트스트랩 토큰 및 볼륨 소유권 사용을 참조하십시오. 복잡하기 때문에 다른 보안 토큰 사용자를 사용하여 ec2-user의 암호를 업데이트하는 것은 좋은 방법이 아닙니다.
대신, 비보안 토큰 사용자로 복구 인스턴스를 생성합니다. 그런 다음, 원본 인스턴스의 루트 볼륨을 복구 인스턴스의 보조 볼륨으로 연결하고 데이터를 마이그레이션합니다.
해결 방법
다음 단계를 완료하십시오.
-
EC2 Mac 인스턴스의 루트 Amazon Elastic Block Store(Amazon EBS) 볼륨의 스냅샷을 생성합니다.
-
새 인스턴스와 동일한 가용 영역에 있는 루트 볼륨 스냅샷에서 Amazon EBS 볼륨을 생성합니다.
-
새 인스턴스에 보조 볼륨으로 EBS 볼륨을 연결합니다.
-
SSH를 사용하여 새 인스턴스를 연 다음, 보조 볼륨을 인스턴스에 연결합니다.
-
새 인스턴스의 모든 물리 디스크, 파티션, Apple File System(APFS) 컨테이너 및 볼륨을 나열하려면 다음 명령을 실행합니다.
diskutil list
출력 예시:
diskutil list /dev/disk0 (internal, physical): #: TYPE NAME SIZE IDENTIFIER 0: GUID_partition_scheme *251.0 GB disk0 1: Apple_APFS_ISC Container disk1 524.3 MB disk0s1 2: Apple_APFS Container disk3 245.1 GB disk0s2 3: Apple_APFS_Recovery Container disk2 5.4 GB disk0s3 /dev/disk3 (synthesized): #: TYPE NAME SIZE IDENTIFIER 0: APFS Container Scheme - +245.1 GB disk3 Physical Store disk0s2 1: APFS Volume InternalDisk 10.3 GB disk3s1 2: APFS Volume Preboot 5.3 GB disk3s2 3: APFS Volume Recovery 919.3 MB disk3s3 4: APFS Volume Data 779.2 MB disk3s5 5: APFS Volume VM 20.5 KB disk3s6 /dev/disk4 (external, physical): #: TYPE NAME SIZE IDENTIFIER 0: GUID_partition_scheme *107.4 GB disk4 1: EFI EFI 209.7 MB disk4s1 2: Apple_APFS Container disk5 107.2 GB disk4s2 /dev/disk5 (synthesized): #: TYPE NAME SIZE IDENTIFIER 0: APFS Container Scheme - +107.2 GB disk5 Physical Store disk4s2 1: APFS Volume Macintosh HD - Data 4.8 GB disk5s1 2: APFS Volume Macintosh HD 9.3 GB disk5s2 3: APFS Snapshot com.apple.os.update-... 9.3 GB disk5s2s1 4: APFS Volume Preboot 5.4 GB disk5s3 5: APFS Volume Recovery 754.6 MB disk5s4 6: APFS Volume VM 20.5 KB disk5s5 /dev/disk6 (external, physical): #: TYPE NAME SIZE IDENTIFIER 0: GUID_partition_scheme *107.4 GB disk6 1: EFI EFI 209.7 MB disk6s1 2: Apple_APFS Container disk7 107.2 GB disk6s2 /dev/disk7 (synthesized): #: TYPE NAME SIZE IDENTIFIER 0: APFS Container Scheme - +107.2 GB disk7 Physical Store disk6s2 1: APFS Volume Macintosh HD - Data 9.4 GB disk7s1 2: APFS Volume Macintosh HD 9.3 GB disk7s2 3: APFS Volume Preboot 5.4 GB disk7s3 4: APFS Volume Recovery 754.6 MB disk7s4 5: APFS Volume VM 20.5 KB disk7s5
참고: dev/disk7을 보조 볼륨의 이름으로 바꾸십시오.
-
보조 볼륨을 올바르게 식별했는지 확인하려면 다음 명령을 실행합니다.
diskutil info disk7
참고: dev/disk7을 보조 볼륨의 이름으로 바꾸십시오.
보조 볼륨의 경우 Device/Media Name 값은 Amazon Elastic Block Store여야 합니다.
출력 예시:$ diskutil info disk7 | Grep Device Device Identifier: disk7 Device Node: /dev/disk7 Device / Media Name: Amazon Elastic Block Store Device Block Size: 4096 Bytes Device Location: External
-
운영 체제(OS)에 보조 볼륨을 마운트하려면 다음 명령을 실행합니다.
$ sudo diskutil mount /dev/disk7s1
참고: dev/disk7을 보조 볼륨의 이름으로 바꾸십시오.
-
디스크가 마운트되었는지 확인하려면 df -h 명령을 실행합니다.
df -h Filesystem Size Used Avail Capacity iused ifree %iused Mounted on /dev/disk5s2s1 100Gi 8.7Gi 81Gi 10% 356840 846823560 0% / devfs 228Ki 228Ki 0Bi 100% 788 0 100% /dev /dev/disk5s5 100Gi 20Ki 81Gi 1% 0 846823560 0% /System/Volumes/VM /dev/disk5s3 100Gi 5.0Gi 81Gi 6% 941 846823560 0% /System/Volumes/Preboot /dev/disk1s2 500Mi 6.0Mi 392Mi 2% 1 4010720 0% /System/Volumes/xarts /dev/disk1s1 500Mi 52Mi 392Mi 12% 53 4010720 0% /System/Volumes/iSCPreboot /dev/disk1s3 500Mi 636Ki 392Mi 1% 51 4010720 0% /System/Volumes/Hardware /dev/disk5s1 100Gi 4.5Gi 81Gi 6% 160213 846823560 0% /System/Volumes/Data /dev/disk3s4 228Gi 108Ki 212Gi 1% 17 2223298800 0% /private/tmp/tmp-mount-K1ov0m map auto_home 0Bi 0Bi 0Bi 100% 0 0 100% /System/Volumes/Data/home /dev/disk7s1 100Gi 8.8Gi 77Gi 11% 204661 802361480 0% /Volumes/Macintosh HD - Data
참고: dev/disk7을 보조 볼륨의 이름으로 바꾸십시오.
-
다음 명령을 실행하여 마운트 지점 디렉터리를 열고 볼륨의 데이터에 액세스합니다.
cd /Volumes/Macintosh\ HD\ -\ Data
참고: /Volumes/Macintosh/HD - Data를 마운트 지점 디렉터리 파일 경로로 바꾸십시오. 보조 볼륨에서 새 인스턴스의 루트 볼륨으로 데이터를 복사하려면 다음 rsync 명령을 실행합니다.
brew install rsync
- 다음 명령을 실행하여 향후 ec2-user에 대해 보안 토큰이 활성화되지 않도록 합니다.
sudo dscl . -append /Users/ec2-user AuthenticationAuthority ";DisabledTags;SecureToken"
sudo /usr/bin/dscl . -passwd /Users/ec2-user
이전 passwd 명령을 실행할 때 오류가 발생한 경우 다음 명령을 실행하십시오.
sudo passwd ec2-user
참고: ec2-user를 Amazon EC2 사용자 이름으로 바꾸십시오. 사용자에게 보안 토큰이 없는지 확인하려면 다음 명령을 실행합니다.
sysadminctl -secureTokenStatus ec2-user
참고: ec2-user를 Amazon EC2 사용자 이름으로 바꾸십시오. 모든 사용자를 표시하려면 다음 명령을 실행합니다.
for user in $(ls /Users); do echo $user; sysadminctl -secureTokenStatus $user; doneUse secure token, bootstrap token, and volume ownership in deployments

관련 콘텐츠
- AWS 공식업데이트됨 2년 전
- AWS 공식업데이트됨 7달 전
- AWS 공식업데이트됨 8달 전