

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# 建立 ONTAP 使用者
<a name="create-new-ontap-users"></a>

**建立新的 SVM 或檔案系統使用者 (ONTAP CLI)**

只有具有 `fsxadmin`角色的檔案系統使用者可以建立新的 SVM 和檔案系統使用者。

1. 若要存取 ONTAP CLI，請執行下列命令，在 Amazon FSx for NetApp ONTAP 檔案系統或 SVM 的管理連接埠上建立 SSH 工作階段。`{{management_endpoint_ip}}` 將 取代為檔案系統管理連接埠的 IP 地址。

   ```
   [~]$ ssh fsxadmin@{{management_endpoint_ip}}
   ```

   如需詳細資訊，請參閱[使用 CLI ONTAP 管理檔案系統](managing-resources-ontap-apps.md#fsxadmin-ontap-cli)。

1. 使用 `security login create` ONTAP CLI 命令在 FSx for ONTAP 檔案系統或 SVM 上建立新的使用者帳戶。

   在範例中插入預留位置的資料，以定義下列必要屬性：
   + `-vserver` – 指定您要建立新 SVM 角色或使用者的 SVM 名稱。如果您要建立檔案系統角色或使用者，請不要指定 SVM。
   + `-user-or-group-name` – 指定登入方法的使用者名稱或 Active Directory 群組名稱。Active Directory 群組名稱只能使用`domain`身分驗證方法和 `ontapi`和 `ssh` 應用程式來指定。
   + `-application` – 指定登入方法的應用程式。可能的值包括 http、ontapi 和 ssh。
   + `-authentication-method` – 指定登入的身分驗證方法。可能的值包括以下：
     + domain – 用於 Active Directory 身分驗證
     + password – 用於密碼身分驗證
     + publickey – 公有金鑰身分驗證的使用者
   + `-role` – 指定登入方法的存取控制角色名稱。在檔案系統層級，唯一可以指定的角色是 `fsxadmin`。

   （選用） 您也可以搭配 命令使用下列一或多個參數：
   + `[-comment]` – 使用 來包含使用者帳戶的符號或註解。例如 **Guest account**。長度上限為 128 個字元。
   + `[-second-authentication-method {none|publickey|password|nsswitch}]` – 指定第二要素驗證方法。您可以指定下列方法：
     + password – 用於密碼身分驗證
     + publickey – 用於公有金鑰身分驗證
     + nsswitch – 用於 NIS 或 LDAP 身分驗證
     + none – 如果您未指定預設值

   ```
   Fsx0123456::> security login create -vserver {{vserver_name}} -user-or-group-name {{user_or_group_name}} -application {{login_application}} -authentication-method {{auth_method}} -role {{role_or_account_name}}
   ```

   下列命令會使用 SSH 搭配密碼登入，`new_fsxadmin`以指派`fsxadmin-readonly`的角色建立新的檔案系統使用者。出現提示時，請為使用者提供密碼。

   ```
   Fsx0123456::> security login create -user-or-group-name new_fsxadmin -application ssh -authentication-method password -role fsxadmin-readonly
   
   Please enter a password for user 'new_fsxadmin':
   Please enter it again: 
   
   Fsx0123456::>
   ```

1. 下列命令會使用 `vsadmin_readonly`角色在 SVM `new_vsadmin` 上建立新的 `fsx` SVM 使用者，設定為使用 SSH 搭配密碼登入。出現提示時，請為使用者提供密碼。

   ```
   Fsx0123456::> security login create -vserver fsx  -user-or-group-name new_vsadmin -application ssh -authentication-method password -role vsadmin-readonly
   
   Please enter a password for user 'new_vsadmin': 
   Please enter it again:
   
   Fsx0123456::>
   ```

1. 下列命令會建立新的唯讀檔案系統使用者`harvest2-user`，供 NetApp Harvest 應用程式用來收集效能和容量指標。如需詳細資訊，請參閱[使用 Harvest 和 Grafana 監控 FSx for ONTAP 檔案系統](monitoring-harvest-grafana.md)。

   ```
   Fsx0123456::> security login create -user-or-group-name harvest2-user -application ssh -role fsxadmin-readonly -authentication-method password
   ```

**檢視所有檔案系統和 SVM 使用者的資訊**
+ 使用以下命令來檢視檔案系統和 SVMs的所有登入資訊。

  ```
  Fsx0123456::> security login show
  
  Vserver: Fsx0123456
                                                                   Second
  User/Group                 Authentication                 Acct   Authentication
  Name           Application Method        Role Name        Locked Method
  -------------- ----------- ------------- ---------------- ------ --------------
  autosupport    console     password      autosupport      no     none
  fsxadmin       http        password      fsxadmin         no     none
  fsxadmin       ontapi      password      fsxadmin         no     none
  fsxadmin       ssh         password      fsxadmin         no     none
  fsxadmin       ssh         publickey     fsxadmin         -      none
  new_fsxadmin   ssh         password      fsxadmin-readonly 
                                                            no     none
  
  Vserver: fsx
                                                                   Second
  User/Group                 Authentication                 Acct   Authentication
  Name           Application Method        Role Name        Locked Method
  -------------- ----------- ------------- ---------------- ------ --------------
  new_vsadmin    ssh         password      vsadmin-readonly no     none
  vsadmin        http        password      vsadmin          yes    none
  vsadmin        ontapi      password      vsadmin          yes    none
  vsadmin        ssh         password      vsadmin          yes    none
  10 entries were displayed.
  
  Fsx0123456::>
  ```