Script to enable SSH, rename computer, and join AD Domain on Mac (Mountain Lion) Here is a script we are using as a post-installation task to enable SSH, set the computer name, and then join the computer to our Active Directory managed domain. Unbind from a server in Directory Utility on Mac. Click Unbind, authenticate as a user who has rights to terminate a connection to the Active Directory domain, then click OK. If you see an alert saying the credentials weren't accepted or the computer can't contact Active Directory, click Force Unbind to forcibly break the connection. Mac Terminal Lookup IP or Domain Geographical. Sep 12, 2020 Mac OS X 0 comments. From time-to-time I need to find the geographic location of any IP address or its domain name. It's quickest for me to do this from the Mac Terminal. Here's a shortcut you can set up to make it really easy to get the GEOIP data for a domain name or IP.
Here is a script we are using as a post-installation task to enable SSH, set the computer name, and then join the computer to our Active Directory managed domain.
Note: the template we are using to name our Macs is the letter 'M' followed by the serial number. You can edit the script to take out the M before '$SN', or you can append anything else you'd like onto it, such as an asset take or location.
Please set HOST, DOMAIN, ADUSERNAME, and ADPASS to match the information for your domain. ADUSERNAME and ADPASS should be a user with sufficient privilages to add the computers to the domain.
#!/bin/bash
HOST='ADserver.domain.com'
DOMAIN='domain.com'
ADUSERNAME='admin'
ADPASS='secretpassword'
# Enable SSH
Beast's Domain Mac Os Catalina
echo 'Enabling SSH'
systemsetup -setremotelogin on
launchctl load -w /System/Library/LaunchDaemons/ssh.plist
# Find the serial number
SN=$(system_profiler | grep 'r (system)' | tail -1 | awk '{print $4}')
Beast's Domain Mac Os X
echo 'Serial Number: $SN'
# Set HostName, LocalHostName, and ComputerName to M$SN
echo 'Setting computer names to M$SN'
scutil --set HostName M$SN
scutil --set LocalHostName M$SN
scutil --set ComputerName M$SN
# Add computer to Active Directory
echo 'Adding computer to Active Directory'
dsconfigad -preferred $HOST -domain $DOMAIN -u $ADUSERNAME -p $ADPASS