Passing a password to “su” command over sshexec from ant

China☆狼群 提交于 2019-12-08 02:20:19

问题


Is there any way to pass a password to the linux "su" command? I'm attempting to automate a deployment using sshexec and Ant. As part of that I need to execute the "su" command, but I can find no way to give it a password. The su command does not have the -S switch like sudo. I've tried using the commandResource and input properties on sshexec, but I just get an "su: Sorry" back.

Before anyone thinks I am, I am not storing passwords in files. The script to execute is being generated in memory in Ant based on prompting for a password.


回答1:


Not an expert at this but you should probably use sudo instead of su. The following thread might help more pass-password-to-su-sudo-ssh



来源:https://stackoverflow.com/questions/10919381/passing-a-password-to-su-command-over-sshexec-from-ant

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