WindowsEC2Instance忘記密碼如何重置

這個(gè)問(wèn)題搞了我2天時(shí)間,所以要好好記錄一下。對(duì)于Windows Server 2012之前和Server 2016之后的處理方式是不一樣的,我在誤打誤撞中,用了2012的方法解決了2016的問(wèn)題, 因?yàn)槲也恢劳浢艽a的EC2是2016版本。
而且Windows的這類(lèi)問(wèn)題(忘記key pair和密碼)的處理方式比Linux的要復(fù)雜。

商水網(wǎng)站建設(shè)公司成都創(chuàng)新互聯(lián),商水網(wǎng)站設(shè)計(jì)制作,有大型網(wǎng)站制作公司豐富經(jīng)驗(yàn)。已為商水成百上千家提供企業(yè)網(wǎng)站建設(shè)服務(wù)。企業(yè)網(wǎng)站搭建\成都外貿(mào)網(wǎng)站建設(shè)要多少錢(qián),請(qǐng)找那個(gè)售后服務(wù)好的商水做網(wǎng)站的公司定做!

  1. 關(guān)閉該instance, 這個(gè)instance tag標(biāo)記為original-instance

Windows EC2 Instance 忘記密碼如何重置

  1. 到Volume處找到該instance的volume,然后Detach

Windows EC2 Instance 忘記密碼如何重置

  1. 刪除舊Key

Windows EC2 Instance 忘記密碼如何重置

  1. 創(chuàng)建一個(gè)新的EC2 Instance,tag標(biāo)記為new-instance
    Windows EC2 Instance 忘記密碼如何重置

  2. 新Instance要跟有問(wèn)題的在同一個(gè)區(qū)域,例如us-east-1a,不然無(wú)法加載volume

Windows EC2 Instance 忘記密碼如何重置

  1. Launch,然后弄一個(gè)跟之前(已經(jīng)丟失忘記的key)一樣的key名字,并下載保存key

Windows EC2 Instance 忘記密碼如何重置

以下這步很關(guān)鍵,之前的嘗試我都弄錯(cuò)了

  1. 把忘記密碼的instance創(chuàng)建Image

Windows EC2 Instance 忘記密碼如何重置

  1. 然后在IMAGES -- > AMI中查看進(jìn)度,需要幾分鐘時(shí)間,完成后點(diǎn)Launch,這個(gè)步驟跟新建instance類(lèi)似,為跟那個(gè)新建的instance區(qū)分開(kāi)來(lái),我們把這個(gè)instance命名為 image-instance

Windows EC2 Instance 忘記密碼如何重置

  1. 創(chuàng)建好后關(guān)閉此Instance,然后把image-instance的volume掛載到new-instance上

Windows EC2 Instance 忘記密碼如何重置

  1. 登入new-instance,并下載工具:https://s3.amazonaws.com/ec2rescue/windows/EC2Rescue_latest.zip (這個(gè)工具僅適用于2016及其后版本的 Windows Server)

Windows EC2 Instance 忘記密碼如何重置

Windows EC2 Instance 忘記密碼如何重置

Windows EC2 Instance 忘記密碼如何重置

Windows EC2 Instance 忘記密碼如何重置

Windows EC2 Instance 忘記密碼如何重置

Windows EC2 Instance 忘記密碼如何重置

另外我之前看文檔說(shuō)可以通過(guò)修改Ec2Config service來(lái)實(shí)現(xiàn)密碼修改,后來(lái)摸索后才發(fā)現(xiàn)這在2012及之前的版本才可以,而我的忘記密碼的服務(wù)器是2016版本,這也是我奇怪之前沒(méi)有在路徑下看到C:\Program Files\Amazon\Ec2ConfigService這個(gè)文件夾了,所以我從2012上copy了一個(gè)到這個(gè)路徑,同時(shí)修改了config.xml文件,把EC2Password改為Enabled,不知道跟這個(gè)有沒(méi)關(guān)系,權(quán)且記錄在案。

  1. 然后把這個(gè)volume在new-instance上offline,并從Volume上Deattach掉,然后重新掛回image-instance,注意要把Device設(shè)為 /dev/sda1,這樣才是C盤(pán)

Windows EC2 Instance 忘記密碼如何重置

  1. 獲取image-instance的密碼

Windows EC2 Instance 忘記密碼如何重置

  1. 導(dǎo)入保存的key文件獲取密碼,(剛開(kāi)始的時(shí)候是失敗的,提示無(wú)法獲取密碼,驗(yàn)證不對(duì),在此我又糾結(jié)了幾個(gè)小時(shí),在這個(gè)3個(gè)instance之前互相切換掛載,后來(lái)就可以獲得密碼了,不知哪里弄對(duì)了)

Windows EC2 Instance 忘記密碼如何重置

  1. 然后再關(guān)閉這個(gè)image-instance, 把這個(gè)volume掛載回orignal-instance為C盤(pán),啟動(dòng),這樣就用新的key獲取新的密碼

參考文檔
適用于server 2012及其前版本:https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/ResettingAdminPassword_EC2Config.html

適用于server 2016及其后版本:https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/ResettingAdminPassword_EC2Launch.html

這個(gè)提到要完全按照步驟來(lái),我也是受這個(gè)啟發(fā),重新看文檔才發(fā)現(xiàn)我沒(méi)有l(wèi)aunch image,而是搞了launch new instance,這點(diǎn)很關(guān)鍵。https://stackoverflow.com/questions/50686939/resetting-administrator-password-for-aws-ec2-windows-server-2012-instance

后來(lái)收到AWS Support發(fā)來(lái)的郵件支持信息,不過(guò)我的問(wèn)題已經(jīng)自己解決,所以沒(méi)有使用他們的方法,記錄如下:
對(duì)于server 2016

  1. In the Amazon IAM Console (https://console.aws.amazon.com/iam/), in the navigation pane, choose Roles, Create new role.

  2. Choose Amazon EC2 Role for Simple Systems Manager, and then choose Select.

  3. Under Policy Name, check AmazonEC2RoleforSSM, Next Step, enter a Role name that is meaningful to you and choose Create Role.

  4. Open the Amazon EC2 console, https://console.aws.amazon.com/ec2/ and choose the appropriate region.

  5. Select the affected instance, choose Actions, Instance Settings, Attach/Replace IAM role. This would attach the IAM role you just created to your instance.

  6. From EC2 console select, "Run Command" and "Run a command" option.

  7. Select "AWS-RunPowershellScript" from Command document

  8. In Select Targets, Select the instance you want to reset password for. Should the instance not be populated in the list, please wait for some time so that the changes can be propagated.

  9. Under Commands, run the following command while replacing "new_password" with your password.

    net user Administrator new_password

  10. Click Run in the lower right, leaving all the settings at default.

Following the successful completion of the run command, you should now be able to log in with that local administrator password you just keyed in under step 9. Once you've regained access to the instance, change the password to a more permanent value by running the command from step 9 again in command prompt of the instance.

Another procedure you can follow to reset the password on the instance is to use the AWSSupport-ResetAccess Automation document from the Systems Manager console. This document is useful if you have lost your EC2 key pair and want to create a password-enabled AMI from your EC2 instance, so you can launch a new instance with an existing key pair. To perform this, you can follow the steps given on the link under the section headed "Systems Manager Automation AWSSupport-ResetAccess (Offline Method)":

[+] https://aws.amazon.com/premiumsupport/knowledge-center/reset-admin-password/

網(wǎng)頁(yè)標(biāo)題:WindowsEC2Instance忘記密碼如何重置
轉(zhuǎn)載來(lái)于:http://www.kartarina.com/article24/gspije.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供品牌網(wǎng)站設(shè)計(jì)外貿(mào)網(wǎng)站建設(shè)品牌網(wǎng)站建設(shè)虛擬主機(jī)網(wǎng)站策劃網(wǎng)站排名

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶(hù)投稿、用戶(hù)轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

成都網(wǎng)站建設(shè)
主站蜘蛛池模板: 亚洲av无码有乱码在线观看| 一本大道无码人妻精品专区| 少妇无码一区二区三区免费| 最新无码人妻在线不卡| 亚洲精品无码成人| 亚洲情XO亚洲色XO无码| 亚洲AV无码一区二区大桥未久| 亚洲日韩VA无码中文字幕| 久久久久亚洲AV无码观看| 亚洲av无码成人精品区在线播放| 无码播放一区二区三区| 久久午夜无码免费| a级毛片无码免费真人久久 | 亚洲乱亚洲乱妇无码麻豆| 亚洲精品无码一区二区| 蜜芽亚洲av无码精品色午夜| 人妻少妇AV无码一区二区| 无码一区二区三区在线| 精品无码久久久久国产动漫3d| 久久亚洲av无码精品浪潮| 亚洲最大av无码网址| 无码人妻精品一二三区免费| 无码日本精品XXXXXXXXX| 精品无码久久久久久午夜| 亚洲AV区无码字幕中文色| 国产av无码专区亚洲av桃花庵| 亚洲综合最新无码专区| 台湾无码AV一区二区三区| 亚洲精品无码激情AV| 中文字幕丰满乱子伦无码专区| 国产精品无码永久免费888 | 曰韩精品无码一区二区三区| 亚洲一本大道无码av天堂| 国产成人无码aa精品一区| 精品无码中出一区二区| 亚洲AV无码乱码在线观看性色扶| 亚洲av无码成人精品区在线播放| 无码欧精品亚洲日韩一区夜夜嗨| 妖精色AV无码国产在线看| 无码国产亚洲日韩国精品视频一区二区三区 | 色综合色国产热无码一|