Note: This presupposes the user already has administrator/superuser rights. Because of this, for most users the root account does not generally need to be enabled.
- The following will open an
shor bashprocess with full root privileges:
- The following will log you in with full root privileges:
sudo su -If one runs
sualone, it will prompt for the root password, but with sudo first it instead prompts for the current user's password. The dash at the end loads the root user environment.
- The following sets a password for the root user, thereby enabling normal login for root:
sudo passwd rootOn some systems, OS X not included, the following will reverse the last command, both disabling the root login and removing its password hash:
sudo passwd -dl root
- To enable root login:
- To disable root login:
For more information: