LoginSignup
0
1

More than 3 years have passed since last update.

Linux 一般ユーザーへのsudo 権限付与

Posted at

1「wheel」グループに「abcde」ユーザーを追加します。

usermod -G wheel abcde

2visudoを編集

visudo

3コマンドの意味を理解しましょう

## Allow root to run any commands anywhere
root    ALL=(ALL)       ALL

root rootユーザーは
ALL= 全てのホストから
(ALL) 全てのユーザーとして実行でき
ALL 全てのコマンドが実行できる
```

4rootではなくwheelグループに対して権限を追加します

先頭の「#」を外してこの行を有効にします。

# Allows people in group wheel to run all commands
%wheel  ALL=(ALL)       ALL

5 権限が効いてるか確認します。

rootをログアウトしてabcdeユーザでログインします。

ここではcatで実行が許可されていないコマンドを実行してみましょう。
通常の方法では権限がないためabcdeユーザで実行しても「許可がありません」とエラーが表示されます。

cat /var/log/secure

では続いてsudoを最初に用いて同じコマンドをたたいてみましょう。

sudo cat /var/log/secure

実行できていれば権限付与終了です

0
1
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
1