Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/google-sheets/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Bash 如何在使用shell脚本将Linux计算机加入Active Directory时输入密码?_Bash_Shell_Dns_Ldap_Integration - Fatal编程技术网

Bash 如何在使用shell脚本将Linux计算机加入Active Directory时输入密码?

Bash 如何在使用shell脚本将Linux计算机加入Active Directory时输入密码?,bash,shell,dns,ldap,integration,Bash,Shell,Dns,Ldap,Integration,我正在将Linux机器加入windows active directory,并且我能够使用SSSD成功地完成这项工作 现在,我正在尝试自动化相同的过程,在这个过程中,我遇到了在加入域时需要输入密码的步骤 有人可以帮助您通过shell脚本输入密码吗 我的代码是: #!/bin/bash set -x passwd=`cat /domain/domain_join.txt | grep password | awk -F '[=]' '{print$2}'` /usr/bin/expect &

我正在将Linux机器加入windows active directory,并且我能够使用SSSD成功地完成这项工作

现在,我正在尝试自动化相同的过程,在这个过程中,我遇到了在加入域时需要输入密码的步骤

有人可以帮助您通过shell脚本输入密码吗

我的代码是:

#!/bin/bash

set -x

passwd=`cat /domain/domain_join.txt | grep password | awk -F '[=]' '{print$2}'`
 /usr/bin/expect << EOF
 spawn realm join domainname -U username@domainname -v
 expect "Password for username@domainname: \r"
 send "$passwd\r"
EOF
set +x
#/bin/bash
集合x
passwd=`cat/domain/domain_join.txt | grep password | awk-F'[=]'{print$2}'`

/usr/bin/expect这实际上不是LDAP问题,而是AD、Kerberos和sshd

看起来你已经有了一个用户帐户来加入这台机器——大概它拥有正确的权限。最简单的方法是为该帐户创建一个keytab,然后您可以执行
kinit
,并在该上下文中调用脚本

kinit principal@EXAMPLE.COM -k -t keytab; joinscript
如果您已经完成了
kinit
,则不需要在
realm join
命令中定义用户名

很抱歉,我无法测试这个,已经有一段时间了,但是秘方是Windows凭据的密钥表