📌  相关文章
📜  在一行中使用密码运行 sudo 命令 - Shell-Bash 代码示例

📅  最后修改于: 2022-03-11 14:51:08.161000             🧑  作者: Mango

代码示例3
# Run `visudo` to edit the file `/etc/sudoers`:
sudo visudo

# For example, to allow the `shutdown` command to run without a password. 
# Add this to the file, replacing `myusername` with your own login name for your PC:
myusername ALL = NOPASSWD: /sbin/shutdown

# NOTE: `sudo` is still required to run the command so you still have to specify the command as:
sudo shutdown