我试图做类似须藤苏与用户名,密码和命令
echo 'my_password' | sudo -S su -c some-user ./some_command
我已经看过
How can I apply password to sudo in one line command and execute su root?
和
run a sudo command, specifying the password on the same line
但这些都不能真正回答我的问题波夫。
我仍然收到我的用户密码提示。
为什么不直接设置sudo来提示某个用户执行some_command的密码呢? –
使用从其他团队设置sudo的服务器。所以我不能在我的用户之外运行任何命令。吮吸。那么我通过ansible作为根源运行,但这不是常态。 –