7
14

More than 5 years have passed since last update.

Linuxにおける色々なユーザー管理コマンド

Last updated at Posted at 2015-06-30

概要

Linuxにおいて、よく使うであろうユーザー管理のコマンドをまとめてみました

コマンド

bash
#通常のユーザー新規追加コマンド
$ useradd hogeuser
$ passwd hogeuser

#ログイン出来ないユーザーを新規に作成する
$ useradd -s /sbin/nologin hogeuser

#通常に作成した後、ログインできなくしてしまう
$ usermod -s /sbin/nologin hogeuser

#ログイン出来ないユーザーをログインできるようにする
$ usermod -s /bin/bash hogeuser

#ユーザーをグループに追加する
$ gpasswd -a hogeuser hogegroup

#ユーザーをグループから削除する
$ gpasswd -d hogeuser hogegroup

それらの情報を確認する

bash
# ユーザーログインシェルの確認(ユーザーがログインできるかどうか)
$ cat /etc/passwd | grep hogeuser

# ユーザーがどのグループに所属しているか
$ id hogeuser
7
14
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
7
14