How to Become Root in Ubuntu
Root access is required to perform a lot of administrative actions on Ubuntu, such as installing software. Although root is a common user in other Linux distributions, Ubuntu locks it by default. Instead, commands are provided to give administrators temporary access to root commands, which helps prevent accidental mistakes and keeps the system more secure from intruders.
- 1Open the Terminal. You can access the Terminal by searching for "terminal" in the Dash, or by pressing ^ Ctrl+⎇ Alt+T.
- 2Learn the sudo command. Ubuntu locks the root user by default. This is done as a security measure. You can instead gain root access for any command by prepending the sudo command to the beginning. You will be asked for your user password and then perform the command as root.
- For example: sudo /etc/init.d/networking restart will restart your network hardware. You will be required to enter your user password before the command occurs.
- To use sudo, the user must be a part of the Administrator group. You can add users to this group by clicking System → Administration. Select the user from the list and click Properties. Click the User Privileges tab and then check the "Administer the system" box.
- 3Learn the gksudo command. This is the equivalent command for sudo when you want to launch programs with a graphical interface. This will prevent files in your Home directory from being transferred to root ownership.
- For example: gksudo gedit /etc/fstab opens the "fstab" file in GEdit, an external editing program.
- 4Simulate a root environment. If you really need root access, you can simulate root using sudo. This will provide you with unhindered root access, which means a mistyped command could destroy your system.
- Enter the command sudo passwd root. This will create a password for your root account, essentially "enabling" it. Make sure you don't forget this password.
- Enter the command sudo -i. You will be asked for your root password.
- Your prompt will change from $ to #, indicating you have root access.
- To disable root access, enter the command sudo passwd -dl root.[1]
0 Nhận xét