linuxshellactive-directory

How to supply the password as an argument in realm join to active directory command


I am trying to automate few areas like joining the linux server to active directory. To join the server to AD, I am using the following command:

realm join -U <Username> exmaple.com

The above command will prompt for a password which need to provided during the execution time. My requirement is to supply the password as an argument in realm join command just like

realm join -U <Username> -P <Password> example.com --> This is not working

Can someone help me to figure out the way to supply the password as an argument here ?


Solution

  • This is resolved. Following is the answer

    echo $password | realm join -U <Username> example.com

    replace $password with your actual password