如何新增nginx配置器組?

如何新增nginx配置器組?

我想建立一個使用者群組,該使用者群組有權在沒有 sudo 權限的情況下建立/編輯/查看 nginx 配置,但我不知道如何操作。

建立普通使用者群組並將 nginx 配置位置的owner:group 設定為 same-owner:configurator-group,使用者可以編輯和查看,但建立檔案會將新檔案擁有者和群組設定為使用者。

答案1

- 提供在 Ubuntu 系統上管理使用者群組和檔案權限的概述。

使用groupadd指令建立使用者群組:

sudo groupadd configurator

使用 usermod 指令新增應成為配置程式組成員的使用者:

sudo usermod -a -G configurator [username]

更改 Nginx 設定檔的所有權和權限以允許設定者群組讀取和寫入檔案:

sudo chown root:configurator /etc/nginx/conf.d/*
sudo chmod 640 /etc/nginx/conf.d/*

您可能想要阻止配置器群組的成員在 /etc/nginx/conf.d 目錄中建立新檔案。為此,您可以在目錄上設定黏滯位:

sudo chmod +t /etc/nginx/conf.d

相關內容