0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

[Linux] ユーザとグループの管理_情報管理_passwd, gpasswd, id, getent

Last updated at Posted at 2025-06-28

passwdコマンド

$ passwd [オプション] [ユーザー名]
オプション 由来(略) 説明
default password 自分自身のログインパスワードを変更
管理者以外は他人のパスワードは変更不可
-l lock アカウントをロックする(パスワードの前に ! を付加)
-u unlock ロックされたアカウントをアンロック(! を除去)

gpasswdコマンド

$ gpasswd [オプション] [グループ名]
オプション 由来(略) 説明
default group password 指定した グループのパスワードを設定・変更する(あまり一般的ではない)
-a ユーザー名 add member 指定したユーザーをグループに追加
例:gpasswd -a alice developers

idコマンド

$ id [オプション] [ユーザー名]
オプション 由来 説明
default identity 実行中のユーザーの UID, GID, グループ情報を表示
-u user ID UID(ユーザーID)のみを表示
-g group ID GID(グループID)のみを表示
-G Groups すべての所属グループの GID を表示

getentコマンド

$ getent [データベース] [キー]
オプション/使い方 由来 説明
default get entries 指定したデータベース(passwd, group, hosts など)からエントリを取得
getent passwd passwd database ローカルおよび NSS 経由ですべてのユーザー情報を取得(/etc/passwd のような内容)
getent passwd ユーザー名 passwd lookup 指定ユーザーの情報のみ表示
getent group group database グループ情報一覧を表示(/etc/group 相当)
getent group グループ名 group lookup 指定グループの情報のみ表示

Ping-t

全般

gpasswd

id

getent

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?