个人开发可将指定用户设置为sudoers,生产环境还是要遵守各用户的权限职责。
root 用户编辑指定配置文件
vim /etc/sudoers
配置信息设置
#
# Adding HOME to env_keep may enable a user to run unrestricted
# commands via sudo.
#
# Defaults env_keep += "HOME"
Defaults secure_path = /sbin:/bin:/usr/sbin:/usr/bin
## Next comes the main part: which users can run what software on
## which machines (the sudoers file can be shared between multiple
## systems).
## Syntax:
##
## user MACHINE=COMMANDS
##
## The COMMANDS section may have other options added to it.
##
## Allow root to run any commands anywhere
root ALL=(ALL) ALL
www ALL=(ALL) NOPASSWD:ALL
最后一行,把www用户设置为免密执行 sudo 最高管理权限。