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?

【Linux入門】特定のユーザーに特定のプログラムのみsudo権限を付与する

Posted at

環境

  • AlmaLinux8.9

Sudo権限を付与する

ユーザーのsudo権限を管理するには/etc/sudoersファイルを編集することで行えます。

  • 構文
<username> <hostname.example.com>=(<run_as_user>:<run_as_group>) <path/to/command>
  • 解説
    • <username>
      • コマンドを入力するユーザー
      • %で始まる場合はグループを定義(例: %users)
    • <hostname.example.com>
      • ルールが適用されるホスト名
    • (<run_as_user>:<run_as_group>)
      • コマンドを実行するユーザーまたはグループを定義
      • 省略するとroot としてコマンドを実行
    • <path/to/command>
      • コマンドの絶対パス
      • パスの後にオプションを追加することで特定のオプションを制御可能
      • オプションなしの場合は全てのオプションが有効

それぞれの項目はALLに置き換えることができ、その場合は全てのユーザーなどを指定することができるので要注意

!演算子を使用することができ、!rootとした場合はroot以外のすべてのユーザーを指定できる。

user ALL = /usr/bin/python3.11, /usr/bin/zip

参考サイト

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?