Chown 在 sudoers 文件中:安全与否?

Mik*_*ike 9 sudo www-data chown vulnerability

在 sudoers 文件中添加此命令是否安全?

mike ALL= NOPASSWD:/bin/chown -R www-data\:www-data /var/www
Run Code Online (Sandbox Code Playgroud)

这是我想运行的唯一命令

$mike@ubuntu: sudo chown -R www-data:www-data /var/www
Run Code Online (Sandbox Code Playgroud)

谢谢你。

And*_*w B 8

是的。

来自man sudoers

   If a Cmnd has associated command line arguments, then the arguments in
   the Cmnd must match exactly those given by the user on the command line
   (or match the wildcards if there are any).  Note that the following
   characters must be escaped with a '\' if they are used in command
   arguments: ',', ':', '=', '\'.  The special command "sudoedit" is used
   to permit a user to run sudo with the -e option (or as sudoedit).  It
   may take command line arguments just as a normal command does.
Run Code Online (Sandbox Code Playgroud)