gpt4 book ai didi

shell - 如何将用户名/密码传递到ambari-server sync-ldap命令中

转载 作者:行者123 更新时间:2023-12-02 19:41:15 25 4
gpt4 key购买 nike

我正在尝试使用sync ldap命令运行剧本:
ambari-server sync-ldap --all
问题是,在执行命令后,它要求输入用户名,然后要求输入密码。

无论如何,是否有必要从echo或使用脚本 shell 自动传递用户名和密码,而无需手动传递?

最佳答案

尝试以下脚本

# cat /tmp/ambari-server-sync-ldap-unattended.sh
#!/usr/bin/expect
set timeout 20
spawn /usr/sbin/ambari-server sync-ldap --groups=/etc/ambari-server/ambari-groups.csv
expect "Enter Ambari Admin login:" { send "admin\n" }
expect "Enter Ambari Admin password:" { send "notTheRealPasswordOfCourse\n" }
interact

关于shell - 如何将用户名/密码传递到ambari-server sync-ldap命令中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59965901/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com