我正在使用苹果远程桌面来尝试将我们的Mac绑定到AD。 每当我收到错误dsconfigad: Invalid credentials supplied for binding to the server 。
dsconfigad -add domain.com -computer TESTMAC -username tech -password "Mypass$$-" -localhome enable -useuncpath disable -groups "Domain Admins, Enterprise Admins" -alldomains enable -mobile enable -mobileconfirm disable
我知道string中的所有内容都是正确的,凭据是正确的,因为如果我SSH进入计算机并在没有密码的情况下运行它,它会提示input密码,并且正确绑定。
我唯一的想法是-password "Mypass$$-"部分在语法上有错误,但是我明确地跟着man()页面。
https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man8/dsconfigad.8.html
解决了,
我在密码中使用的特殊字符之一似乎没有在命令(转义字符或东西也许)jive很好无论如何,我改变了密码,一切都很好!
shell使用双引号执行某些事情的解释,例如,如果你的密码实际上包含$$ ,它将被shell的进程IDreplace。 实际上,如果它包含$ ,它会执行某种replace(细节取决于$ )。 另外,反引号,反斜杠,感叹号以及其他一些我忘记的东西都会在双引号内引发各种replace。
解决scheme:改用单引号。 shell在单引号string中唯一的作用是查找close引号,所以只要你的密码中没有单引号(又名撇号),-password'Mypass -password 'Mypass$$-'应该可以工作。