Saturday, October 15, 2022

How to become the root user via Terminal on macOS?


There are two ways of becoming the root user on the macOS terminal.

Option 1. sudo -i

Run the following commands on the Terminal.

macOS:/Users/eryu% whoami
analysisman

macOS:/Users/eryu% sudo -i
Password:

macOS:~ root# whoami
root

macOS:~ root# exit
logout

Option 2. sudo su

Run the following commands on the Terminal.

macOS:/Users/eryu% whoami
analysisman

macOS:/Users/eryu% sudo su
Password:

%m:%d%% whoami
root

%m:%d%% exit
exit

References

https://superuser.com/questions/592323/how-do-i-become-root-on-mac-os-x

Links

[[_Index_2_macOS]]

No comments: