# Unix Passwdプラグイン

{% hint style="warning" %}
パスワードのローテーションには、KeeperPAMによるゼロトラスト方式もあります。ほとんどの用途では、そちらの利用を推奨します。詳細は以下をご参照ください。

* [KeeperPAMを使用したパスワードローテーション](/keeperpam/jp/secrets-manager/password-rotation.md)
* [コマンダーのKeeperPAMコマンド](/keeperpam/jp/commander-cli/command-reference/keeperpam-commands.md)
  {% endhint %}

このプラグインを使用すると、Unixの`passwd`コマンドを使用してローカルユーザーのパスワードをローテーションできます。

## 前提条件

#### pexpectのインストール

```
pip3 install pexpect
```

## ローテーション用のレコードを準備

### ローテーション用のレコードを作成

ローテーションは、従来のレコードにもタイプ指定されたレコードにも対応しています。 タイプ指定されたレコードを使用する場合は、「ログイン」タイプのフィールドが必要です。 ローテーションの種類に応じて、その他のフィールドを追加することもできます。 以下の手順をご参照ください。

{% hint style="info" %}
従来のレコードとタイプ指定のあるレコードの詳細については、[トラブルシューティング](/keeperpam/jp/commander-cli/troubleshooting-commander-cli.md#typed-vs-untyped-records-v3-vs-v2)をご参照ください。
{% endhint %}

### ログイン名を設定

**Keeperのレコードの「ログイン」フィールドにこのローテーションで使用するログインを入力します。**

<figure><img src="https://859776093-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPL6k1aGsLiFiiJ3Y7zCl%2Fuploads%2FAv4svdwmsWeu2OXDi28H%2Fimage.png?alt=media&#x26;token=43d47143-aa13-4208-bd52-75ecaf2b481a" alt=""><figcaption></figcaption></figure>

#### その他のローテーション設定

ローテーションパラメータをカスタマイズできる値は以下のとおりです。 これらのオプションをテキストフィールドとしてレコードに追加し、表に示すように、パラメータに相当するラベルを設定します。

<table><thead><tr><th width="147.33333333333334">名前</th><th width="177">値</th><th>コメント</th></tr></thead><tbody><tr><td>cmdr:plugin</td><td>unixpasswd</td><td>(任意) Unixパスワードのローテーションを使用するようにCommanderに指示します。 これは、レコードに設定するか、またはローテーションコマンドに指定する必要があります</td></tr><tr><td>cmdr:rules</td><td><p>「大文字の数, 小文字の数, 数字の数, 記号の数」</p><p>(たとえば、4,6,3,8)</p></td><td>(任意) パスワード生成ルール</td></tr></tbody></table>

<figure><img src="https://859776093-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPL6k1aGsLiFiiJ3Y7zCl%2Fuploads%2F3WO2NbXJ0MAHVOkKz9uH%2Fimage.png?alt=media&#x26;token=cf1684a6-2be6-4b4a-9a56-269a7bb429dc" alt=""><figcaption><p>Unixパスワードローテーション用のKeeperのレコードの設定</p></figcaption></figure>

## ローテーション

Unixのパスワードをローテーションするには、コマンダーで`rotate`コマンドを使用します。 コマンドにレコードタイトルもしくはUIDを渡します (複数のレコードを1度にローテーションさせるには、正規表現で`--match`を使用します)。

```
rotate "My Azure Credentials" --plugin unix
```

{% hint style="info" %}
プラグインは、こちらに示すようにコマンドに指定することも、レコードのフィールドに追加することもできます (上記のオプションを参照)。\
レコードにプラグインタイプを追加すると、プラグインの異なる複数のレコードを1度にローテーションできます。
{% endhint %}

#### 出力

ローテーションが完了すると、新しいパスワードがレコードの`パスワード`フィールドに格納されます。


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.keeper.io/keeperpam/jp/commander-cli/command-reference/plugins/unix-passwd-plugin.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
