Authenticate with AD credentials via ARD / SSH
Binding a Mac to an AD is fairly straight forward. Most Mac Admin’s worth their salt, know how this is done, many know how to do this via the command line. Once your Mac is bound, authentication is easy, local authentication that is. But what if you want to use your secure AD credentials over an SSH or Apple Remote Desktop connection? Well thats when things need a bit more configuration. Having recently deployed a series of servers with this configuration I figured I would share some of the commands needed to get this configured correctly.
The way to accomplish ARD AD authentication is by nesting an AD group inside a local group. You can create any group you want but for the sake of this article we will use ARD_ADMIN. I need to credit this article. The UNT Apple Managers group is a valuable and often looked over internet resource. I highly recommend checking out their group articles and tutorials.
Setup ARD Access
- Create a Local ARD_ADMIN group using dscl in Terminal:
- Now you just need to create an active directory group that you will add to the ARD_ADMIN group. I already had such a group, I wanted to add the ARD group to the ARD_ADMIN group to add the group use this command
- Now that you have a local group with an AD group nested inside, you can give your group the necessary privileges via the ARD Kickstart command:
- The last step in this process is to set the ARD client options to allow directory logins, again do this via the ARD Kickstart command:
Setup SSH Access
The process here is pretty straight forward. You would add a user to SSH, active directory or otherwise using the System Preferences, Sharing preference pane. But what if the admin account in question is hidden? Hidden accounts can be great for system admins who want to hide a backup or admin account on their workstation
However there is no way to add a user that is hidden, to get around this you can un-hide the user using this command
Once done, you can add the user via System Preferences -> Sharing, the Remote Login option should have a spot for “Only these users”.
If you’ve properly joined the machine to the domain, you should be able to select the group from the “+” sign. To re-hide any formerly hidden user accounts run this command
The Apple Way: How to allow administration of OS X from network-based accounts
Apple has its own write up on how to authenticate users via active directory credentials.
System Preferences
- You can add a network user to the local admin group using System Preferences.
- Log in with a network user account.
- From the Apple menu, choose System Preferences.
- From the View menu, choose Users & Groups.
- Select the “Allow user to administer this computer” checkbox.
- Enter a current administrator’s name and password when prompted.
Directory Utility (Active Directory)
- You can add Active Directory (AD) groups to the local admin group using Directory Utility. (Only Active Directory groups may be added using this method.)
- From the Apple menu, choose System Preferences.
- From the View menu, choose Users & Groups.
- Click Login Options.
- Click the Edit button by “Network Account Server”.
- Click the Open Directory Utility button to open Directory Utility (/System/Library/CoreServices/Directory Utility).
- Click the lock in the lower left corner to authenticate.
- Under the Services tab, double-click Active Directory to edit it.
- Click the disclosure triangle next to “Show Advanced Options” to reveal its contents.
- Under the Administrative tab, click the “Allow administration by” checkbox to enable it.
- Click the add button (+) to add new entries to the list.
- Click OK to save your changes.
Command line (advanced)
If you’re familiar with using Terminal and the command line, you can add network users or groups to the local admin group using the dseditgroup command in Terminal. The following example adds a network user to the admin group:
In this example, “localadmin” is the name of a local administrator account on the workstation (you’re prompted for this account password) and “networkuser” is the short name of the network user.
Conclusion
As you can tell there are many ways to accomplish administration, of your Mac via an active directory user account. Locally, via ARD / VNC and SSH. A few things to toss in, in the event that you run into some roadblocks with some of the terminal commands
To add a single Active Directory user to the local ard_admin group, do not use dscl to add or delete individual users. Use dseditgroup with the -a (to add) or -d (to delete) options.
Remember the man pages for the Kickstart command are hidden. You can not just type “man kickstart” in terminal, this will not work. You can access this man page and others using the following commands:
Active Directory authentication doesn’t always work so you want to be sure that you have a local admin account waiting in the wings in the event that something goes south with the AD bind to the Mac.