可以 : echo "yourpasswd" |sudo -S yourcommand
但是不安全,因为密码都显示在shell脚本里面了-_-
引自http://hi.baidu.com/mgqw/blog/item/2824bb01ccd5570a7aec2cd9.html
suspend
本文介绍如何通过echo命令配合sudo执行特定操作如挂起(suspend)或休眠(hibernate),并指出这种方式的安全隐患。文章提供了两个示例脚本,分别用于实现挂起和休眠功能。
可以 : echo "yourpasswd" |sudo -S yourcommand
但是不安全,因为密码都显示在shell脚本里面了-_-
引自http://hi.baidu.com/mgqw/blog/item/2824bb01ccd5570a7aec2cd9.html
suspend
转载于:https://www.cnblogs.com/huashiyiqike/p/3606165.html
1427
2万+

被折叠的 条评论
为什么被折叠?