LoginSignup
0
0

More than 3 years have passed since last update.

勉強メモ4_visudoコマンドがrootユーザーしかできなかったのを、sudoで一般ユーザーもできるようにする

Posted at

★1 rootでログイン rinchomeユーザー作成

#グループ作成
[root@localhost ~]#groupadd rinchome
#ユーザー作成(グループをrinchomeにする)
[root@localhost ~]#useradd -g rinchome rinchome
#rinchomeユーザーのパスワードを変更
[root@localhost ~]#passwd rinchome

★2 rinchomeユーザーでログイン sudo visudoコマンド実行

#visudoコマンド実行
[rinchome@localhost ~]$ sudo visudo
あなたはシステム管理者から通常の講習を受けたはずです。
これは通常、以下の3点に要約されます:

    #1) 他人のプライバシーを尊重すること。
    #2) タイプする前に考えること。
    #3) 大いなる力には大いなる責任が伴うこと。

[sudo] rinchome のパスワード:
rinchome は sudoers ファイル内にありません。この事象は記録・報告されます。
[rinchome@localhost ~]$

★3 ★2でできなかったので、rootでログイン visudoを編集

[root@localhost ~]# visudo

以下↓↓を
## Same thing without a password
 %wheel ALL=(ALL)       NOPASSWD: ALL

以下↓↓に変更
 ## Same thing without a password
# %wheel        ALL=(ALL)       NOPASSWD: ALL
 %rinchome      ALL=(ALL)       NOPASSWD: ALL

★4 rinchomeでログイン もう一回、sudo visudoコマンドを実行、編集画面にいった

[rinchome@localhost ~]$ sudo visudo

## Sudoers allows particular users to run various commands as
## the root user, without needing the root password.
##
## Examples are provided at the bottom of the file for collections
## of related commands, which can then be delegated out to particular
## users or groups.

★5 まとめ

適当ななんちゃってSEなので、あってるかは不明
0
0
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
0
0