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?

More than 1 year has passed since last update.

【Linux】ユーザーにsudo権限を付与する

Posted at

一般ユーザ(今回はdevelop)でsudoコマンドを実行しようとしたら以下のように怒られました。

develop@XXX:XXX$ sudo xxxx
[sudo] password for develop:
develop is not in the sudoers file.  This incident will be reported.

root権限で、developにsudoの権限を付与

root@XXX:XXX# sudo usermod -aG sudo develop

コマンド
usermod:ユーザーのホームディレクトリやグループ、パスワードなどを変更するためのコマンド。実行には「rootユーザー(スーパーユーザー)」の権限が必要。

オプション
-a :「-G」オプションで指定したグループをセカンダリーグループに追加する
-G :セカンダリーグループを変更する(複数ある場合は「,」で区切って指定)。変更ではなく追加したい場合は「-a」オプションを同時に指定する

確認

root@DESKTOP-AMENJF4:~# groups develop
develop : develop sudo

セカンダリーグループにsudoが追加されている。

再試行

再起動したあと、developで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?