提供:すだちWiki
移動先: 案内検索

ヘルプ:一般ユーザの作成&削除

メインページ > ヘルプ:目次 > ヘルプ:自宅サーバーの管理(CentOS7)  > 一般ユーザの作成&削除

ユーザーの作成

SSHは鍵認証方式なので、鍵の設定をしないとSSHは使えない。ユーザディレクトリでのホームページ公開も、パーミションの変更をしないと使えない。従って、ここで作成したユーザーはメールのみ使える。

※例として一般ユーザー名をsudachiとする

[root@host2 ~]# useradd sudachi ← 一般ユーザーの作成

[root@host2 ~]# passwd sudachi ← ユーザーパスワード設定
Changing password for user sudachi.
New UNIX password:  ← ユーザーパスワード応答
Retype new UNIX password:  ← ユーザーパスワード応答(確認)
passwd: all authentication tokens updated successfully.

ユーザーの削除

※例として一般ユーザー名をsudachiとする。

[root@host3 ~]# userdel -r sudachi ← ユーザーsudachiの削除

rootになれるユーザーを管理者のみにする

例として、管理者用の一般ユーザー名をsudachiとする。

[root@host3 ~]# usermod -aG wheel sudachi

ユーザーの所属グループ追加

※例としてユーザー名をsudachiとする。

[root@host3 ~]# usermod -aG apache sudachi

ユーザーの所属グループ削除

[root@host3 ~]# gpasswd -d sudachi apache

ユーザ sudachi をグループ apache から削除

ユーザーの所属グループ確認

※例としてユーザー名をsudachiとする。

[root@host3 ~]# id sudachi
uid=1000(ssudachi) gid=1000(sudachi) groups=1000(sudachi),10(wheel),48(apache)