itemコマンド

1Passwordマニュアル|アイテムの作成、削除、編集、取得方法を詳しく解説。安全に情報を管理するためのステップバイステップガイドです。

サブコマンド

  • item create: アイテムをCreateする

  • item delete: アイテムを削除またはアーカイブする

  • item edit: アイテムの詳細を編集する

  • item get : アイテムの詳細を取得する

  • item list: アイテムをリストする

  • item move: 保管庫間でアイテムを移動する

  • item share: アイテムを共有する

  • item template: テンプレートの管理

item create

新しいアイテムをCreateします。

op item create [ - ] [ <assignment>... ] [flags]

Flags

--category category Set the item's category.

--dry-run Test the command and output a preview of the resulting item.

--favorite Add item to favorites.

--generate-password[=recipe] Add a randomly-generated password to a Login or Password item.

--reveal Don't conceal sensitive fields.

--ssh-generate-key The type of SSH key to create: Ed25519 or RSA. For RSA,

specify 2048, 3072, or 4096 (default) bits. Possible values:

ed25519, rsa, rsa2048, rsa3072, rsa4096. (default Ed25519)

--tags tags Set the tags to the specified (comma-separated)

values.

--template string Specify the filepath to read an item template from.

--title title Set the item's title.

--url URL Set the URL associated with the item.

--vault vault Save the item in this vault. Default: Private.

全てのアイテム カテゴリのリストを取得します。

$ op item template list

割り当てステートメントまたはアイテム カテゴリ JSON テンプレートを使用して、組み込みフィールドまたはカスタム フィールドに詳細をSaveします。

アイテムのCreateについて詳しく紹介します。

アイテム フィールドとフィールド タイプの詳細について説明します。

Generate a password

ログインまたはパスワード項目にランダムなパスワードを設定するには、オプションを使用します--generate-password。デフォルトは 32 文字で、大文字と小文字、数字、記号 ( [email protected]_*) が含まれます。

パスワードの長さ (1 ~ 64 文字) と使う文字の種類を指定できます。

$ --generate-password='letters,digits,symbols,32'

Set additional fields with assignment statements

組み込みフィールドとカスタム フィールドを設定するには、代入ステートメントをコマンド引数として使用できます。

[<section>.]<field>[[<fieldType>]]=<value>

コマンド引数はコマンド履歴に記録され、マシン上の他のプロセスから参照できます。機密値を割り当てる場合は、代わりに JSON テンプレートを使用してください。

例えば、「データベース資格情報」というセクション内に「host」というテキスト フィールドをCreateし、値を 33.166.240.221 に設定するには、次のようにします。

$ --generate-password='letters,digits,symbols,32'

複数のセクションに同じ名前のフィールドが含まれていない限り、セクション名はオプションです。

セクション名またはフィールド名内のピリオド、等号、またはバックスラッシュをエスケープするには、バックスラッシュを使用します。値をエスケープするためにバックスラッシュを使用しないでください。

セクション名またはフィールド名のスペースを省略したり、JSON 短縮名 (nameまたはn)でフィールドを参照したりできます。

Create an item using a json template

アイテム JSON テンプレートを使用して、アイテムに機密値を割り当てます。テンプレートと割り当てステートメントを組み合わせた場合、割り当てステートメントが優先されます。

  • ①適切なアイテム カテゴリ テンプレートをファイルにSaveします。

  • $ op item template get --out-file login.json "Login"

  • ②テンプレートを編集します。

  • ③編集したテンプレートへのパスを指定する——templateフラグを使用して新しいアイテムをCreateします。

  • $ op item create --template=login.json

  • ④1Password CLI がアイテムをCreateしたら、編集したテンプレートを削除します。 アイテム JSON テンプレートを使用して、標準入力からアイテムをCreateすることもできます。 文字を最初の引数として渡し-、その後に代入ステートメントを続けます。

  • $ op item template get Login | op item create --vault personal -

  • 衝突を避けるため、同じコマンドでパイプと--templateフラグの両方を使うことはできません。

フラグと、割り当てステートメントで設定されたカスタム フィールドと組み込みフィールド (ワンタイム パスワード フィールドとファイル添付を含む) を使用して、ランダム パスワードと Web サイトが設定されたログイン項目をCreateします。

$ op item create --category=login --title='My Example Item' --vault='Test' \

--url https://www.acme.com/login \

--generate-password=20,letters,digits \

username[username][email protected] \

'Test Section 1.Test Field3[otp]=otpauth://totp/<website>:<user>?secret=<secret>&issuer=<issuer>' \

'FileName[file]=/path/to/your/file'

別の保管庫から保存済みのアイテムを複製し、割り当てステートメントを使用して変更することでアイテムをCreateします。

$ op item get "My Item" --format json | op item create --vault prod - \

username="My Username" password="My Password"

あるアカウントの Vault 内の全てのアイテムを別のアカウントの Vault に複製します。

$ op item list --vault test-vault --format json --account agilebits | \

$ op item get --format json --account agilebits - | \

$ op item create --account work -

item delete

アイテムを完全に削除します。

op item delete [{ <itemName> | <itemID> | <shareLink> | - }] [flags]

Flags

--archive Move the item to the Archive.

--vault string Look for the item in this vault.

代わりに--archiveオプションを使用してアーカイブに移動します。

アイテムは、名前、ID、または共有リンクで指定できます。

Specify items on standard input

このコマンドは、標準入力 (stdin) 上の各情報行をオブジェクト指定子として扱います。オブジェクトの指定方法の詳細については、op helpを実行してください。

入力は、JSON オブジェクトのリストまたは配列にすることもできます。このコマンドは、ID を持つオブジェクトの項目を取得します。これは、あるopコマンドから別のコマンドに情報を渡す場合に便利です。

アイテムを完全に削除します:

op item delete "Defunct Login"

アイテムをアーカイブに移動する:

op item delete "Defunct Login" --archive

item edit

アイテムの詳細を編集します。

op item edit { <itemName> | <itemID> | <shareLink> } [ <assignment> ... ] [flags]

Flags

--dry-run Perform a dry run of the command and output a preview

of the resulting item.

--favorite Whether this item is a favorite item. Options: true, false.

--generate-password[=recipe] Give the item a randomly generated password.

--reveal Don't conceal sensitive fields.

--tags tags Set the tags to the specified (comma-separated)

values. An empty value will remove all tags.

--template string Specify the filepath to read an item template from.

--title title Set the item's title.

--url URL Set the URL associated with the item.

--vault vault Edit the item in this vault.

アイテムを名前、ID、または共有リンクで指定します。フラグを使用してタイトルやタグを更新したり、新しいランダム パスワードを生Createしたりします。

組み込みフィールドまたはカスタム フィールドを更新するために、代入ステートメントをコマンド引数として使用できます。機密値の場合は、代わりにテンプレートを使用します。

Edit an item using assignment statements

注意: コマンド引数は、マシン上の他のプロセスから見える場合があります。

$ [<section>.]<field>[[<fieldType>]]=<value>

新しいフィールドまたはセクションをCreateするには、アイテムにまだ存在しないフィールドまたはセクションの名前を指定します。

保存済みのフィールドを編集するには、現在のセクションとフィールド名を指定し、fieldType または値を変更します。 fieldType または値を指定しない場合、値は変わりません。

カスタムフィールドを削除するには、fieldType の代わりに [delete] を指定します。セクションにフィールドがなくなった場合、そのセクションも削除されます。組み込みフィールドは削除できませんが、空の文字列に設定することはできます。代入ステートメントの詳細については、op item create –-help を参照してください。

利用可能なフィールドとフィールド タイプの詳細をご覧ください。

Edit an item using a template

JSON テンプレートを単独で、またはコマンド引数と組み合わせて使用​​して、項目を編集できます。フィールド割り当てステートメントは、テンプレート内の値を上書きします。

  • 1. 編集したい項目を JSON 形式で取得し、ファイルにSaveします。

  • op item get oldLogin --format=json > updatedLogin.json

  • 2. ファイルを編集します。

  • 3. フラグを使用して--template編集したファイルへのパスを指定し、項目を編集します。 op 項目の編集 oldLogin --template=updatedLogin.json

  • 4. ファイルを削除します。 パイプ入力を使用してアイテムを編集することもできます。

  • $ cat updatedLogin.json | op item edit oldLogin

衝突を避けるため、パイプ入力と--template フラグを同じコマンド内で組み合わせることはできません。

大文字、小文字、数字、記号を含む 32 文字のランダムなパスワードをアイテムに追加します。

$ op item edit 'My Example Item' --generate-password='letters,digits,symbols,32'

フィールドタイプを変更せずにカスタムフィールドの値を編集します。

op item edit 'My Example Item' 'field1=new value'

値を変更せずにカスタム フィールドの fieldType を編集します。

op item edit 'My Example Item' 'field1[password]'

カスタム フィールドのタイプと値を編集します。

op item edit 'My Example Item' 'field1[monthyear]=2021/09'

アイテムに新しいカスタム フィールドを追加します。

op item edit 'My Example Item' 'section2.field5[phone]=1-234-567-8910'

保存済みのカスタム フィールドを削除します。

op item edit 'My Example Item' 'section2.field5[delete]'

組み込みのユーザー名フィールドを空の値に設定します。

op item edit 'My Example Item' 'username='

コマンド引数および代入ステートメントとともにテンプレートを使用して項目を編集します。

$ op item edit oldLogin --vault Private 'username=Lucky' --template=updatedLogin.json

item get

アイテムの詳細を取得します。アイテムの名前、ID、または共有リンクでアイテムを指定します。

op item get [{ <itemName> | <itemID> | <shareLink> | - }] [flags]

Flags

--fields strings Return data from specific fields. Use `label=` to get the field by name or `type=` to filter fields by type. Specify multiple in a comma-separated list.

--include-archive Include items in the Archive. Can also be set using

OP_INCLUDE_ARCHIVE environment variable.

--otp Output the primary one-time password for this item.

--reveal Don't conceal sensitive fields.

--share-link Get a shareable link for the item.

--vault vault Look for the item in this vault.

同じ名前のアイテムが複数ある場合、または API レート制限が懸念される場合は、アイテムを ID で指定するか、フラグを使用して検索範囲を制限します--vault。

ID とキャッシュについて詳しく紹介します。

特定のフィールドの内容を取得するには、代わりに op read を使用します。サービス アカウントを使う場合は、 --vault フラグを使うか、パイプ入力を通じてコン​​テナーを指定する必要があります。

Specify items on standard input

op item getは、標準入力 (stdin) 上の各情報行をオブジェクト指定子として扱います。

JSON オブジェクトのリストまたは配列を入力することもできます。コマンドは、ID キーを持つオブジェクトの項目を取得します。これは、あるコマンドから別のコマンドに情報を渡す場合に便利です。

Items in the archive

アーカイブ内のアイテムはデフォルトでは無視されます。アーカイブ内のアイテムの詳細を取得するには、アイテムを ID で指定するか、 --include-archiveオプションを使用します。

指定されたタグを持つ全てのアイテムの詳細を取得します。

op item list --tags documentation --format json | op item get -

保管庫内の全てのログインのユーザー名とパスワードの CSV リストを取得します。

op item list --categories Login --vault Staging --format json | op item get - --fields label=username,label=password

アイテムのユーザー名とパスワード フィールドの JSON オブジェクトを取得します。

op item get Netflix --fields label=username,label=password --format json

タイプ別にフィールドのリストを取得します。

op item get Netflix --fields type=concealed

アイテムのワンタイムパスワードを取得します:

op item get Google --otp

ID で参照されるアイテムの共有可能なリンクを取得します。

op item get kiramv6tpjijkuci7fig4lndta --vault "Ops Secrets" --share-link

item list

項目をリストします。

op item list [flags]

Flags

--categories categories Only list items in these categories (comma-separated).

--favorite Only list favorite items.

--include-archive Include items in the Archive. Can also be set using

OP_INCLUDE_ARCHIVE environment variable.

--tags tags Only list items with these tags (comma-separated).

--vault vault Only list items in this vault.

デフォルトでアカウントが読み取りアクセス権を持つ全てのアイテムのリストを返します。結果をフィルタリングするにはフラグを使用します。デフォルトではアーカイブ内のアイテムは除外されます。

カテゴリーは次のとおりです:

  • API Credential

  • Bank Account

  • Credit Card

  • Database

  • Document

  • Driver License

  • Email Account

  • Identity

  • Login

  • Membership

  • Outdoor License

  • Passport

  • Password

  • Reward Program

  • Secure Note

  • Server

  • Social Security Number

  • Software License

  • Wireless Router

指定されたタグを持つ全てのアイテムの詳細を取得します。

op item list --tags documentation --format=json | op item get -

保管庫内の全てのログインのユーザー名とパスワードの CSV リストを取得します。

op item list --categories Login --vault Staging --format=json | op item get - --fields username,password

タグを選択すると、<tag>にサブネストされたタグを持つアイテムも返されます<tag>。例: <tag/subtag>。

item move

アイテムを保管庫間で移動します。

アイテムを移動すると、移動先の保管庫にアイテムのコピーがCreateされ、現在の保管庫からアイテムが削除されます。その結果、アイテムには新しい ID が付与されます。

op item move [{ <itemName> | <itemID> | <shareLink> | - }] [flags]

Flags

--current-vault string Vault where the item is currently saved.

--destination-vault string The vault you want to move the item to.

--reveal Don't conceal sensitive fields.

元のアイテムを復元または完全に削除するには、1Password アプリまたは 1Password.com の「最近削除した項目」でアイテムを見つけます。

アイテムを保管庫間で移動すると、そのアイテムにアクセスできるユーザーが変わる場合があります。

プライベート 保管庫から共有保管庫にアイテムを移動します。

op item move "My Example Item" --current-vault Private --destination-vault Shared

item share

アイテムを共有します。

op item share { <itemName> | <itemID> } [flags]

Flags

--emails strings Email addresses to share with.

--expires-in duration Expire link after the duration specified in (s)econds,

(m)inutes, (h)ours, (d)ays, and/or (w)eeks. (default 7d)

--vault string Look for the item in this vault.

--view-once Expire link after a single view.

1Password を使用していない人でも、1PasswordにSaveしたパスワードやその他の項目のコピーを安全に共有できます。

アイテムを共有すると、他のユーザーに送信できる固有のリンクが取得されます。

URL をコピーし、メールやテキスト メッセージなどで、アイテムのコピーを共有したい相手にリンクを送信します。メール フラグでアドレスを指定しない限り、リンクを知っている人なら誰でもアイテムのコピーを表示できます。

アイテムを編集した場合、そのアイテムを再度共有するまで変更内容は共有されません。添付ファイルとドキュメント アイテムは共有できないことに注意してください。

item template

item template get

アイテム タイプのテンプレートを返します。

op item template get [{ <category> | - }] [flags]

Flags

--file-mode filemode Set filemode for the output file. It is ignored without the --out-file flag. (default 0600)

-f, --force Do not prompt for confirmation.

-o, --out-file string Write the template to a file instead of stdout.

テンプレートを使用して新しいアイテムをCreateできます。詳細についてはop item create --help実行してください。

カテゴリーは次のとおりです:

  • API Credential

  • Bank Account

  • Credit Card

  • Database

  • Document

  • Driver License

  • Email Account

  • Identity

  • Login

  • Membership

  • Outdoor License

  • Passport

  • Password

  • Reward Program

  • Secure Note

  • Server

  • Social Security Number

  • Software License

  • Wireless Router

item template list

使用可能なアイテム タイプ テンプレートを一覧表示します。

op item template list [flags]

テンプレートを取得するためにop item template get <category>使用します。

Last updated