Automating password into sudo

自古美人都是妖i 提交于 2019-12-13 04:36:25

问题


I'm completely new to the Linux world, but I've been able to complete a few tasks on my own.

Now, I have a task to complete that's driving me crazy.

I need to be able to send the password to sudo, since I can't prompt the user for the password.

What I've been able to find is

echo myPassword | sudo -s

Apparently -s allows sudo to receive the password through command input, and not user input.

I can't render my user so sudo won't ask me for password, since I don't know who will use this script, the script has access to their password and account names, the only thing I need it to be able to automate sudo.

PS: English is not my native language, sorry if I made any mistakes.

来源:https://stackoverflow.com/questions/32463277/automating-password-into-sudo

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!