向其他用户提供 sudo

Providing sudo to another user

我想授予测试用户 sudo 访问权限,以便在 linux 中切换到 test2 sudo 命令。但是测试用户不应该去root账户。

请帮忙, 谢谢

使用 sudoers 文件。它是 macos 的模拟,但在 linux 中是相同的。 https://apple.stackexchange.com/questions/82438/allow-sudo-to-another-user-without-password

在 /etc/sudoers - 添加测试 ALL=(ALL) NOPASSWD:/bin/sudo /bin/su - test2

这有效