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
sh orbash process with full root privileges:sudo sh
sudo bash
- The following will log you in with full root privileges:
sudo su -
If one runssu alone, 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 root
On 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:
dsenableroot
- To disable root login:
dsenableroot -d
For more information: