Running command on mac

I’m trying to run the command “adgpupdate” on MACs to update the AD Site info for Centrify. I have tried several was, but I still keep getting feedback in the logs like:

Command started - wait “/usr/bin/sudo -u root /bin/bash -c adgpupdate” (action:2093964)
Command failed (child exec() failed (errno is 2: No such file or directory) wait “/usr/bin/sudo -u root /bin/bash -c adgpupdate” (action:2093964)

I have had to do similar things in Linux to set the user environment to run commands like this, but the MAC is being stubborn.

The client on the mac is already running as root so not sure why you need to sudo to root though?

My first attempt just tried running that command on its own oh, then I tried using bash to run the command and it still failed. I wasn’t sure if I had to run sudo to instantiate some environment variables to get the command to work. Running sudo in the past in Linux has worked for me.

I don’t maintain any Mac, sorry…but is it correct to doublequote the whole wait command line? I’d expect waithidden to treat that all as one big filename containing spaces, rather than as a command with parameters…

good point, you shouldn’t be quoting the whole line unless there is a need (like spaces)

@JasonWalker, you were correct. Still can’t get this to work.

I did try several ways to run this command…

Command started - wait "sudo -u root adgpupdate" (action:2097610)
Command failed (child exec() failed (errno is 2: No such file or directory) wait "sudo -u root adgpupdate" (action:2097610)

Command started - wait adgpupdate (action:2097628)
Command failed (child exec() failed (errno is 2: No such file or directory) wait adgpupdate (action:2097628)

Command started - wait sudo -u root -c adgpupdate (action:2097629)
Command succeeded (Exit Code=1) wait sudo -u root -c adgpupdate (action:2097629)

Funny thing, whereis adgpupdate comes back with nothing. It’s like the command doesn’t exists. Or it’s some internal command. That’s why I’m trying to ‘sudo -u root’ the command. That’s the sort of thing I have had to do in the past in linux to make sure the user session is fully set. Session variables and all.

Maybe using full pathnames to adgpupdate?

that’s the thing, I don’t know where that command is.

sh-3.2# whereis adgpupdate <---- comes back with no results.
sh-3.2# whereis bash
/bin/bash

Again, no Mac here. But if your shell doesn’t find it, besclient probably won’t either.

Just based on Delinea Support , maybe you can find it at /Library/Application Support/Centrify ?

Or based on https://centrify.force.com/support/Article/KB-2919-How-to-silently-install-version-5-1-x-of-the-CDC-Agent-for-Mac-OS-X it may be at /usr/sbin ?

Or from Documentation Library maybe /usr/local/sbin ? (This link lists several of the default paths so it may be more useful as well)

When you complete the installation, the local computer will be updated with the following directories and files for Centrify:
This directory
Contains
/etc/centrifydc
The Centrify agent configuration file and the Kerberos configuration file.
/usr/local/share/centrifydc
Kerberos-related files and service library files used by the Centrify agent to enable group policy and authentication and authorization services.
/usr/local/sbin
/usr/bin
Command line programs to perform Active Directory tasks, such as join the domain and change a user password.
/var/centrifydc
No files until you join the domain. After you join the domain, several files are created in this directory to record information about the Active Directory domain the computer is joined to, the Active Directory site the computer is part of, and other details.
/System/Library/Frameworks/DirectoryService.framework/Resources/Plugins
The Centrify Directory Service Plugin, CentrifyDC.dsplug, that enables you to join or leave the domain using the graphical user interface.

I would’ve thought those last two would be in the default path though (besclient may not find it, but I’d at least think that ‘whereis’ would).

It really is strange, I can type it in my shell and run it, but BESAgent can’t find it.

That said, I got it to work. I found the full path of /usr/local/bin/adgpupdate. Yet, /usr/local/bin is in the path varabile

sh-3.2# echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/sbin

A lot of assumptions like $PATH being defined may not necessarily work from the BESAgent (since it’s not natively running under a shell). What surprises me is that ‘whereis’ didn’t find it either.

1 Like

Again, it has been my experience of using something like wait “sudo -u root -c adgpupdate” would fix any path issues. Maybe that just doesn’t work on the MAC

I also do not have adgpupdate on my Mac (macOS 10.13.2) and it seems that it might be a specific implementation of a Centrify tool? ( https://community.centrify.com/t5/TechBlog/Introducing-the-New-Mac-Diagnostic-Tool/ba-p/11328 )