Openfire official install/setup guide

Hi,
I have been installing Openfire on Debian (version 8 and 9) and Ubuntu 16 server. Quite straight foward with instruction like this one https://www.vultr.com/docs/how-to-setup-an-openfire-xmpp-server-on-ubuntu-16-04-lts

Install and setup Openfire 4.2.1 or 4.2.3 to use AD user database. It seem to work ok until the Linux server is restart, once the server restart the AD users cannot authenticate anymore and I cannot login admin console. The only fix is to reset the xml file and run the Setup again.

Obviously I screw up somewhere, do you have some idiot How-to guide ? I have post similar question in another thread Cannot login after reboot - Openfire 4.2.1
Common responds:

  • Is there any change to AD service account? No, Openfire stop authenticating user as soon as I restart Linux server. I have other LAMP stack using AD accounts no problem.
  • Is the Openfire running? Yes, I enable openfire service to run at startup by “systemctl enable openfire.service”, and I check service status by “systemctl status openfire.service”

sounds like there may be a permissions issue somewhere. Id suggest making sure the account running openfire has write/modify permission to openfire.xml

I thought it is the case, I changed the /etc/openfire/openfile.xml permision to writable for everyone “chmod a+w openfire.xml” restart the server, AD authentication broke. check the file permission, it was reverted to -rw-r–r-- as before.
Correction: I gave write permission for everyone, run setup wizard, LDAP authentication work. Check the /etc/openfile/openfile.xml the permission was reverted to default. Is there another openfile.xml in a different location ? Also reading the xml file, there is no reference to AD or LDAP, unless these information is stored in MySQL database.
Doesn’t matter what change I make to /usr/share/openfile/conf/openfile.xml everytime the openfire service restart, the xml file is revert to some kind of default, only the < database> section is saved