Rename computer

Showing results for 
Search instead for 
Do you mean 
Participant II
Posts: 7
Registered: ‎10-01-2015
#1 of 6 6,897
Accepted Solution

Rename computer

[ Edited ]

How do I rename a Mac OS X computer that is joined using Centrify Express Agent for Mac? Must I unjoin, rename and then join again? If I do that, will I need to go into AD and delete the old computer object?


- Eric

Centrify Guru I
Posts: 2,433
Registered: ‎07-26-2012
#2 of 6 6,893

Re: Rename computer



Provided that you have the proper rights in Active Directory, you can do this all from the OS X system straight from the CLI.


It looks like this:

(domain name:;  AD user that can join/remove = dwirth)

# First, leave the domain
$ sudo adleave --remove --user dwirth --verbose

## Here you would rename your mac to the desired name.

# Second, rejoin with the new name
$ sudo adjoin --workstation --user dwirth --verbose

Make sure you know a local admin user just in case the rename requires you to reboot (behavior changes between OS X versions)



Want to learn more about practical Centrify examples? Check out my blog at
Follow Centrify:
Posts: 532
Kudos: 171
Blog Posts: 24
Solutions: 25
Registered: ‎04-19-2012
#3 of 6 6,883

Re: Rename computer

To expand a bit on Robertson's answer above:


OS X uses a couple of different hostname properties and they're all used in slightly different places so it's recommended to keep them all in line.


The full command sequence would look like this:


(1) Log into the Mac as Local Admin and run:


sudo adleave --remove --user dwirth --verbose

sudo scutil --set HostName MAC-HOSTNAME
sudo scutil --set LocalHostName MAC-HOSTNAME
sudo scutil --set ComputerName MAC-HOSTNAME

(2) If possible, go to the DNS server and delete the DNS record of the Mac


(3) Go back to the Mac and run:


sudo adjoin --workstation --user dwirth --verbose



  • "dwirth" is the username of the AD user authorised to leave / join machines from the domain
  • "MAC-HOSTNAME" is the new hostname of the Mac
  • "" is your actual domain name.


This sequence should avoid any potential future issues related to hostname mismatches.



Kind regards,



Participant II
Posts: 7
Registered: ‎10-01-2015
#4 of 6 6,477

Re: Rename computer

[ Edited ]

Thanks, Brian and Robertson.


The solution you propose will indeed result in a machine that has a different name than before and is joined to Active Directory with the new name. However, the Active Directory object has not been renamed; the original object has been orphaned and a new object (with a new GUID) has been created. Any customizations (such as manually editing the Description field) do not get transferred to the new object and the machine is in the default container unless you specify the correct OU in the adjoin command.


As a comparison, you can do the same thing with a Windows machine ad get the same results, but there is a better way. If you log onto the Windows computer with an account with Domain Admin rights and simply rename the computer, it will update the existing Active Directory object, thus retaining the same GUID, OU inheritance, customizations, etc.


It would be really handy if there were a way to accomplist that second scenario on a Mac joined to Active Directory via the Centrify agent.


 - Eric 

Participant I
Posts: 1
Registered: ‎07-05-2017
#5 of 6 400

Re: Rename computer



I've similar issue , some times we clone osx station to another , if this was previusly joined to our domain

is impossible to successfully logon again. 


  1. We use centrify tool to remove from domain  then - Reboot
  2. We set new hostname  then - Reboot 
  3. We use centrify tool to join domain whit new hostsname - Seccessfully - then Reboot
  4. But we are unable to logon whit domain credential 

But if  we  logon whit local user and from terminal  

logon domainusername

password  password domian user name

we get OK 

and domain user profile was created..

also if we try to login whit domain users from gui  WORKS

But if we reboot  NO Logon Again...


If we  reinstall  osx os  works... same  hostname and domain username...


Centrify Guru I
Posts: 2,433
Registered: ‎07-26-2012
#6 of 6 393

Re: Rename computer



Welcome to the forums.

Can you please start a new thread?


Lots of things have changed since 2015 when this thread started.


Also, make sure you provide the current software version.


Note that systems should not be cloned without leaving the domain FIRST.  Then the clone needs to be renamed and rejoined to the directory.


Also note that Centrify no longer is in the OS X business with all the Mac-related products transitioning to Idaptive.




Want to learn more about practical Centrify examples? Check out my blog at
Follow Centrify: