

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

# 為ONTAP使用者設定 Active Directory 身分驗證
<a name="set-up-ad-auth"></a>

使用 ONTAP CLI 為ONTAP檔案系統和 SVM 使用者設定使用 Active Directory 身分驗證。

您必須是具有 `fsxadmin`角色的檔案系統管理員，才能使用此程序中的命令。

**為ONTAP使用者設定 Active Directory 身分驗證 (ONTAP CLI)**

此程序中的命令可供具有 `fsxadmin`角色的檔案系統使用者使用。

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. 使用如下所示的 [https://docs.netapp.com/us-en/ontap-cli-9141/security-login-domain-tunnel-create.html](https://docs.netapp.com/us-en/ontap-cli-9141/security-login-domain-tunnel-create.html)命令來建立網域通道，以驗證 Windows Active Directory 使用者。將 *svm\$1name* 取代為您用於網域通道的 SVM 名稱。

   ```
   FsxId0123456::> security login domain-tunnel create -vserver svm_name
   ```

1. 使用 [https://docs.netapp.com/us-en/ontap-cli-9141/security-login-create.html](https://docs.netapp.com/us-en/ontap-cli-9141/security-login-create.html)命令來建立將存取檔案系統的 Active Directory 網域使用者帳戶。

   在 命令中指定下列必要參數：
   + `-vserver` – 使用 CIFS 設定並加入 Active Directory 的 SVM 名稱。它將用作將 Active Directory 網域使用者驗證為檔案系統的通道。將會建立新角色或使用者。
   + `-user-or-group-name` – 登入方法的使用者名稱或 Active Directory 群組名稱。Active Directory 群組名稱只能使用`domain`身分驗證方法和`ontapi``ssh`應用程式來指定。
   + `-application` – 登入方法的應用程式。可能的值包括 http、ontapi 和 ssh。
   + `-authentication-method` – 用於登入的身分驗證方法。可能的值包括以下：
     + domain – 用於 Active Directory 身分驗證
     + password – 用於密碼身分驗證
     + publickey – 用於公有金鑰身分驗證
   + `-role` – 登入方法的存取控制角色名稱。在檔案系統層級，唯一可以指定的角色是 `-role fsxadmin`。

   下列範例會`CORP\Admin`建立`filesystem1`檔案系統的 Active Directory 網域使用者帳戶。

   ```
   FSxId012345::> security login create -vserver filesystem1 -username CORP\Admin -application ssh -authmethod domain -role fsxadmin
   ```

   下列範例會建立具有公有金鑰身分驗證的`CORP\Admin`使用者帳戶。

   ```
   FsxId0123456ab::> security login create -user-or-group-name "CORP\Admin" -application ssh -authentication-method publickey -role fsxadmin
   Warning: To use public-key authentication, you must create a public key for user "CORP\Admin".
   ```

   使用下列命令為`CORP\Admin`使用者建立公有金鑰：

   ```
   FsxId0123456ab::> security login publickey create -username "CORP\Admin" -publickey "ecdsa-sha2-nistp256 SECRET_STRING_HERE_IS_REDACTED= cwaltham@b0be837a91bf.ant.amazon.com"
   ```

**使用 SSH 搭配 Active Directory 登入資料登入檔案系統**
+ 如果您選擇 `-application`類型，以下範例示範如何使用 Active Directory 登入資料`ssh`將 SSH 傳送至檔案系統。的格式`username`為 `"domain-name\user-name"`，這是您在建立帳戶時提供的網域名稱和使用者名稱，以反斜線分隔並以引號括住。

  ```
  Fsx0123456::> ssh "CORP\user"@management.fs-abcdef01234567892.fsx.us-east-2.aws.com
  ```

  當系統提示您輸入密碼時，請使用 Active Directory 使用者的密碼。