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] ユーザとグループの管理_useradd, usermod, userdel, group,add, groupmod, groupdel, passwd

Last updated at Posted at 2025-06-11

useraddコマンド

# useradd [オプション] ユーザー名
オプション 由来 説明
default user add 新しいユーザーアカウントを作成するためのコマンド
-d directory ユーザーのホームディレクトリを指定
例:/home/username
-m make home ホームディレクトリを自動作成
-s shell ログインシェルを指定
例:/bin/bash
-g group プライマリグループ(GID または グループ名)を指定
-G Groups セカンダリグループをカンマ区切りで複数指定
例:wheel,users
-u UID ユーザーID(UID)を明示的に指定
-c comment コメント(通常はユーザーのフルネーム)を指定
-p password 暗号化されたパスワードを指定
-D default デフォルト設定の表示・変更を行う
例:useradd -D で確認
例:useradd -D -s /bin/zsh で変更

usermodコマンド

# usermod [オプション] ユーザー名
オプション 由来 説明
default user modify 既存のユーザーアカウントを変更するためコマンド
-d directory ユーザーのホームディレクトリの新しいパスを指定
-s shell ログインシェル(/bin/bash など)を変更
-g group プライマリグループ(GID)を変更
-G Groups セカンダリグループをカンマ区切りで指定し追加
-L lock ユーザーアカウントをロック(パスワードの先頭に ! を付けてログイン不能に)
-U unlock -L でロックしたアカウントをアンロック(! を除去)

userdel

groupadd

groupmodコマンド

# groupmod [オプション] グループ名
オプション 由来 説明
default group modify 既存のグループ情報を変更するためのコマンド
-n name グループの名前を変更
例: groupmod -n newgroup oldgroup
-g GID グループのGID(グループID)を変更

groupdel

passwdコマンド

$ passwd [オプション] [ユーザー名]
オプション 由来(略) 説明
default password 対象ユーザーのパスワードを変更するコマンド
-l lock アカウントをロックする(パスワードの前に ! を付加)
-u unlock ロックされたアカウントをアンロック(! を除去)

Ping-t

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?