![]() |
| ◆ | ユーザーの登録 |
|
何でも出来る root
でログインするのはセキュリティー上問題があるので新しくユーザーを登録して通常はそのユーザーでログインします。そして必要に応じて root
になるようにします。 下記のように入力します。青文字が入力文字です。 |
|
|
[root@linux]# useradd xxxx ← useradd xxxx を入力(xxxx と言うユーザーを追加) [root@linux]# passwd xxxx ← passwd user を入力(xxxx のパスワード設定) Changing password for user xxxx. New UNIX password: ****** ← ****** のパスワード入力(* は実際には表示されません) Retype new password: ****** ← 再度 xxxx のパスワード入力(* は実際には表示されません) passwd: all authentication tokens updated successfully. |
|
| また、誰でも root
になれるのは問題がありますので今回登録したユーザー xxxx だけが root になれるように設定します。 ここからの設定は root でログインしていないと出来ませんので root でログインして下さい。 下記のように入力します。青文字が入力文字です。 |
|
|
[root@linux]# usermod -G wheel xxxx ← ユーザxxxxをwheelグループに追加 |
|
| 次に su設定ファイルの編集をします。下記のように入力します。緑色の部分を黄色に変更(書き換え・削除)して下さい。赤文字は説明です。 青文字が入力文字です。 | |
|
[root@linux]# vi /etc/pam.d/su ← 入力 #%PAM-1.0 auth sufficient pam_rootok.so # Uncomment the following line to implicitly trust users in the "wheel" group. #auth sufficient pam_wheel.so trust use_uid # Uncomment the following line to require a user to be in the "wheel" group. #auth required pam_wheel.so use_uid ↓ auth required pam_wheel.so use_uid ← wheelグループ所属ユーザxxxxのみrootになれる auth include system-auth account include system-auth password include system-auth session include system-auth session optional pam_xauth.so |
|
| PC起動時に自動で起動するように設定します。青文字が入力文字です。 | |
|
[root@linux]# echo "SU_WHEEL_ONLY yes" >> /etc/login.defs ← 入力 |
|
| なお、ユーザーを削除する場合は下記のように入力します。青文字が入力文字です。 | |
|
[root@linux]# userdel xxxx ← 入力(xxxx と言うユーザーを削除) |
|
| また、ユーザーをディレクトリごと削除する場合は下記のように入力します。青文字が入力文字です。 | |
|
[root@linux]# userdel -r xxxx ← 入力(xxxx と言うユーザーをディレクトリごと削除) |
|