Passing a password to “su” command over sshexec fr

2019-05-28 11:46发布

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.

标签: linux ant su
1条回答
Root(大扎)
2楼-- · 2019-05-28 12:25

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

查看更多
登录 后发表回答