0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

RHELにおける管理者権限の管理

Posted at

Linux(今回はRed Hat Enterprise Linux)における、ユーザーにsudoコマンドの実行権限を付与する方法についての記事です。

ユーザーに権限を付与する方法としては、/etc/sudoersに該当のユーザーを追加するのが一般的な方法です。
また、wheelという名前のグループがデフォルトで存在し、このグループにいるユーザーはsudoの実行権限を持ちますが、今回はsudouserというグループを新たに作成し、そのグループにいるユーザー全員がsudoの実行権限を持つように設定をします。
この記事では、sudoの実行権限を持ったユーザーがコマンド実行する前提です。

1.グループの作成
sudouserという名前のグループを作成します

$ sudo groupadd sudouser

2.グループの確認
sudoグループが作られていることを確認します

$ sudo less /etc/group
root:x:0:
<中略>
sudouser:x:1002:

3.グループへのsudo実行権限の付与
/etc/sudoersを以下のように編集し、sudouserグループにsudo実行権限を付与します

$ sudo visudo
## Allows people in group wheel to run all commands
%wheel  ALL=(ALL)       ALL
%sudouser ALL=(ALL)       ALL

4.グループへのユーザー追加
sudo実行権限を付与したいユーザーを、sudouserグループに追加します

$ sudo usermod --append -G sudouser <ユーザー名>

5.ユーザーが追加されたことを確認

$ sudo less /etc/group 
root:x:0:
<中略>
sudouser:x:1002:<ユーザー名><ユーザー名>

追加したユーザーがsudoコマンドを実行できることを確認してください。
以上です。

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?