ECS:如何使用 REST API 變更或解除鎖定管理和監控使用者

Summary: 如何使用 API 變更或解除鎖定管理和監控使用者。 如何在無法使用使用者介面存取時變更 emcmonitor 密碼。

This article applies to This article does not apply to This article is not tied to any specific product. Not all product versions are identified in this article.

Instructions

有時使用者會忘記密碼,無法再使用其憑證登錄彈性雲伺服器。

若要使用 REST API 變更密碼:

  1. 獲取當前用戶的清單。以下命令列出除以下所有使用者之外的所有使用者: emcmonitoremcservice:

命令:

# svc_rest_cmd -u root -p ChangeMe /vdc/users/

範例:

admin@ecsnode1:~> svc_rest_cmd -u root -p ChangeMe /vdc/users/
svc_rest_cmd 1.0.10

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<mgmt_user_infos>
  <mgmt_user_info>
    <is_external_group>false</is_external_group>
    <isSystemAdmin>false</isSystemAdmin>
    <isSystemMonitor>false</isSystemMonitor>
    <userId>emcsecurity</userId>
  </mgmt_user_info>
  <mgmt_user_info>
    <is_external_group>false</is_external_group>
    <isSystemAdmin>true</isSystemAdmin>
    <isSystemMonitor>true</isSystemMonitor>
    <userId>lex</userId>
  </mgmt_user_info>
  <mgmt_user_info>
    <is_external_group>false</is_external_group>
    <isSystemAdmin>true</isSystemAdmin>
    <isSystemMonitor>true</isSystemMonitor>
    <userId>root</userId>
  </mgmt_user_info>


查詢特定使用者,包括特殊帳戶,如 emcmonitoremcservice,請使用以下語法:

命令:

# svc_rest_cmd -u root -p ChangeMe /vdc/users/<username>

範例:

admin@ecsnode1:~> svc_rest_cmd -u root -p ChangeMe /vdc/users/emcmonitor
svc_rest_cmd 1.0.10

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<mgmt_user_info>
  <is_external_group>false</is_external_group>
  <is_locked>false</is_locked>
  <isSecurityAdmin>false</isSecurityAdmin>
  <isSystemAdmin>false</isSystemAdmin>
  <isSystemMonitor>true</isSystemMonitor>
  <userId>emcmonitor</userId>
</mgmt_user_info>
  1. 使用密碼建立檔案 SystemAdminSystemMonitor 用戶應具有的訪問許可權。在此範例中,必須重設的使用者是 emcmonitor
命令:
# vi /file/path
  • 按下 Insert 鍵
  • 將下列內容貼上到 CLI 工作階段中:(以滑鼠右鍵按一下的方式與使用 Windows Ctrl+v 快速鍵相同)
<mgmt_user_info_update>
   <password>ChangeMe</password>
   <isSystemAdmin>false</isSystemAdmin>
   <isSystemMonitor>true</isSystemMonitor>
</mgmt_user_info_update>
  • 按下 Esc 鍵
  • 在命令前頭輸入 :wq!
範例:
admin@ecsnode1:~> vi /tmp/emcmonitor
<mgmt_user_info_update>
   <password>ChangeMe</password>
   <isSystemAdmin>false</isSystemAdmin>
   <isSystemMonitor>true</isSystemMonitor>
</mgmt_user_info_update>
  1. 確認檔案內容:
命令:
# cat /file/path
範例:
admin@ecsnode1:~> cat /tmp/emcmonitor
<mgmt_user_info_update>
   <password>ChangeMe</password>
   <isSystemAdmin>false</isSystemAdmin>
   <isSystemMonitor>true</isSystemMonitor>
</mgmt_user_info_update>
NOTE:  Make sure that the SystemAdmin and SystemMonitor is correct, this will change the user abilities.  Match this with the output from step 1.
  1. 使用以下命令重設密碼: svc_rest_cmd

命令:

# svc_rest_cmd PUT -u root -p ChangeMe -xml -file <file_name> /vdc/users/<user_to_change>
範例:
#svc_rest_cmd PUT -u root -p ChangeMe -xml -file /tmp/emcmonitor /vdc/users/emcmonitor
svc_rest_cmd 1.0.10


現在,使用者可以使用步驟 2 中創建的檔案中定義的密碼登錄。


對於鎖定的帳戶,要使用 REST API 解鎖和更改帳戶的密碼,請執行以下操作:
當 VDC 啟用了密碼規則,並且使用者帳戶屬性顯示is_locked為 true 時,此方法有效:

admin@ecsnode1:~> svc_rest_cmd -u root -p ChangeMe /vdc/users/emcservice
svc_rest_cmd 1.0.10

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<mgmt_user_info>
  <is_external_group>false</is_external_group>
  <is_locked>true</is_locked>
  <isSecurityAdmin>false</isSecurityAdmin>
  <isSystemAdmin>false</isSystemAdmin>
  <isSystemMonitor>true</isSystemMonitor>
  <userId>emcservice</userId>
</mgmt_user_info>
  1. 創建包含以下內容的檔。如果啟用密碼規則,則所設定的密碼應符合密碼規則設定的任何準則。
<mgmt_user_info_unlock>
   <password>ChangeMe</password>
</mgmt_user_info_unlock>
  1. 使用以下命令解除鎖定並重設密碼: svc_rest_cmd

命令:

# svc_rest_cmd PUT -u root -p ChangeMe -xml -file <file_name> /vdc/users/<user_to_change>/unlock

範例:

 #svc_rest_cmd PUT -u root -p ChangeMe -xml -file /tmp/emcservice /vdc/users/emcservice/unlock
svc_rest_cmd 1.0.10


預期無輸出。檢查使用者帳戶並驗證 is_locked 值是否設定為 false

admin@ecsnode1:~> svc_rest_cmd -u root -p ChangeMe /vdc/users/emcservice
svc_rest_cmd 1.0.10

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<mgmt_user_info>
  <is_external_group>false</is_external_group>
  <is_locked>false</is_locked>
  <isSecurityAdmin>false</isSecurityAdmin>
  <isSystemAdmin>false</isSystemAdmin>
  <isSystemMonitor>true</isSystemMonitor>
  <userId>emcservice</userId>
</mgmt_user_info>

Additional Information

需要根密碼或使用者介面。如果客戶的密碼不是預設密碼,請詢問他們是否要變更為預設密碼。然後重置用戶密碼,然後在維護完成後將其更改回來。這樣,他們的自定義根密碼就不會顯示在歷史記錄中。

Affected Products

ECS Appliance

Products

ECS Appliance, ECS Appliance Gen 1, ECS Appliance Gen 2, ECS Appliance Gen 3, ECS Appliance Hardware Gen3 EX300, ECS Appliance Hardware Gen3 EX3000, ECS Appliance Hardware Gen1 U-Series, ECS Appliance Hardware Gen1 C-Series , ECS Appliance Hardware Gen2 C-Series, ECS Appliance Hardware Gen2 D-Series, ECS Appliance Hardware Gen2 U-Series, ECS Appliance Hardware Gen3 EX500, ECS Appliance Hardware Series, ECS Appliance Software with Encryption, ECS Appliance Software without Encryption ...
Article Properties
Article Number: 000019704
Article Type: How To
Last Modified: 14 Aug 2025
Version:  4
Find answers to your questions from other Dell users
Support Services
Check if your device is covered by Support Services.