How to change the root password on Mac OS

In brief the steps are as follows;

  • log in to the macOS Unix server using ssh or console or terminal
  • Open a shell prompt/terminal and type the passwd command to change root password

ssh user@mac-server

user$ sudo passwd root

First you need to type the password for the user. After that the passwd command asks for the new password, which you will have to enter two times:

The next time you log in to a macOS Unix server, use the new password for root user.