Hi All, here’s a short and sweet blog post to kick off the new year!
I often get asked about setting up NTP configurations on client devices in a better way than manually. You can do this from the command line simply enough:
NTPServer="time.euro.apple.com" /usr/sbin/systemsetup -setnetworktimeserver "$NTPServer" /usr/sbin/systemsetup -setusingnetworktime on
Swap the “time.euro.apple.com” with your desired NTP server and run the commands as root (using ‘sudo’ in front of them). The first command sets the NTP server address (viewable in the GUI in ‘System Preferences’ under ‘Date & Time’). The second command enables the use of the NTP.
Trick 1: Scripting
As this is a bash command, you can chuck it into a Bash / Shell script. Typically I will put this into a ‘first boot’ script to configure a device during imaging.
Trick 2: AD Domain
Another cool trick is if you’re in an AD domain scenario, you can usually set the domain as the NTP rather than a specific NTP and the client/s will use AD / DNS to find a specific NTP!
E.g. if your NTP servers are ‘time1.example.com’ and ‘time2.example.com’, and your domain is ‘example.com’, set the NTP to the ‘example.com’ address and it should find the NTPs automatically.
There you go, short and sweet.
As always, if you have any questions, queries or comments, let us know below and I’ll try to respond to and delve into as many as I can.