root権限を持つ一般ユーザー作成方法

wheelグループ

UNIX系システム上でスーパーユーザー(root)特権を得ることのできるユーザーの属するOS固有のグループ
$ su
$ sudo
が可能

wheelグループへユーザー追加

# useradd (新規ユーザー名)
# passwd (新規ユーザー名)
[パスワードの設定]
# usermod -G wheel (新規ユーザー名)

wheelグループのユーザーのみにsudoの使用を許可

※ /etc/sudoers を編集
# visudo
※ /etc/sudoers がオープンされる
# Allows people in group wheel to run all commands
# %wheel ALL=(ALL) ALL

%wheel ALL=(ALL) ALL

特定のグループのユーザーのみに管理者権限(root)切り替えを許可

※ /etc/pam.d/su を編集
auth required pam_wheel.so use_uid

wheelグループユーザーのみにsuコマンド実行を許可

※ /etc/login.defs を編集
追加
SU_WHEEL_ONLY yes

テスト

# useradd test
# passwd test
# su test
# sudo
# su –
# テスト終了後は、テスト用のユーザーをホームディレクトリとともに削除
# userdel -r test

移行

次の記事

Excel VBA