4
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Linuxにおけるユーザーの操作まとめ

4
Last updated at Posted at 2015-09-24

Linuxにおけるユーザーの操作まとめ

この記事におけるLinuxディストリビューションは Ubuntu になります
ディストリビューションによってコマンド名は変わってくるのでご了承ください

ユーザーを作成

$ useradd -m user

-m オプションで ユーザーディレクトリの作成 (この場合は /home/user に作られる)

ユーザーのパスワードを作成

$ passwd user

削除して作り直したい場合は

$ passwd -d user
$ passwd user

グループを作成

$ groupadd usergrp

ユーザーにグループを所属

# gpasswd -a user usergrp

usermod -G usergrp user はやめましょう(src)

ユーザーをsudoersに追加

$ sudo su
# vim /etc/sudoers

管理者権限で編集してください。

# User privilege specification
root    ALL=(ALL:ALL) ALL

この部分に1行追加して

# User privilege specification
root    ALL=(ALL:ALL) ALL
user    ALL=(ALL:ALL) ALL

ユーザーのログインシェルを変更

$ sudo chsh -s /bin/bash user

ユーザーの設定を参照

$ id -a
4
5
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
4
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?