You need to use the passwd command. It is used to update the user’s authentication token(s) i.e. password. Let us see how to change the root user password on macOS Unix.

 

How to change root password on macOS Unix

 

The procedure for changing the password of root is as follows:

  • First, log in to the macOS Unix server using ssh or console or terminal app
  • Open a shell prompt/terminal app and type the passwd command to change root password in macOS Unix
  • The actual command to change the password for root on macOS Unix is sudo passwd root

 

macOS Unix change root password command

I am going to log in to my macOS based mac mini server using the ssh command:

ssh vyga@macmini-server

 

If you are using a macbook/MBP, just open the terminal app. Once logged in enter the command passwd as follows:

mbp:~ vyga$ sudo passwd root

 

First you need to type the password for vyga 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/workstation, use the new password for root user.

 

Slightly different procedure for changing passwords in macOS Unix terminal

 

One can use the following procedure too:

mbp:~ vyga$ ssh user@your-mbp-macmini

 

Become a root user via the su command or sudo command:

your-mbp-macmini:~ vyga$ sudo -i

 

Finally change your root user password:

passwd

 

More on passwd command

The passwd command changes the user’s password. For example, change your own password using the Terminal app, run:

passwd

 

To change the password for the user named tom, run:

sudo passwd tom

 

Conclusion

This page explained the process for changing the password of root user using the passwd command on a macOS Unix system. For more information see the passwd command man page by typing the following man command:

man 1 passwd
man 5 passwd

 

Ця відповідь Вам допомогла? 0 Користувачі, які знайшли це корисним (0 Голосів)