Post

设置sudo免密码

1
2
3
4
#!/bin/bash
USER=$(whoami)
echo "${USER} ALL=(ALL) NOPASSWD: ALL" | tee /etc/sudoers.d/${USER}-nopasswd
chmod 0440 /etc/sudoers.d/${USER}-nopasswd

可以避免Cursor调用WSL时,执行sudo命令无法输入密码的问题。

This post is licensed under CC BY 4.0 by the author.