How to get superuser rights in Ubuntu

Author: Clyde Lopez
Date Of Creation: 21 June 2021
Update Date: 1 July 2024
Anonim
How to Become Root User in Linux (Ubuntu 18.04)
Video: How to Become Root User in Linux (Ubuntu 18.04)

Content

To run administrative tasks on Linux, you must have superuser (root) privileges. Most Linux distributions have a separate superuser account, but Ubuntu has this disabled by default. This prevents accidental errors and protects the system from intrusion. To run commands that require administrative access, use the command sudo.

Steps

Method 1 of 2: Running superuser rights with sudo

  1. 1 Press the key combination Ctrl+Alt+Tto open a terminal window. Since superuser rights are disabled by default in Ubuntu, you cannot use the command su and get administrative rights, as in other Linux distributions. Instead, you first need to run the command sudo.
  2. 2 Enter sudobefore entering the remainder of the command. Adding sudo to the beginning of the command will run it as an administrator.
    • Example: command sudo /etc/init.d/networking stop stops the network, and sudo adduser adds a new user to the system. Both of these commands require superuser rights.
    • Before sudo can execute the command, you will need to enter your password. Linux stores the password for 15 minutes, so you don't have to type it all the time.
  3. 3 Enter gksudo before running a command that opens a graphical user interface (GUI) program. For security reasons, Ubuntu does not recommend using the sudo command to run GUI programs. Instead, enter gksudo before the command that starts the program.
    • Example: enter gksudo gedit / etc / fstabto open the "fstab" file in the GEdit GUI text editor.
    • If you are using KDE Window Manager, instead of gksudo enter the command kdesudo.
  4. 4 Simulate the superuser environment. If you are an advanced user and want to open a Linux console with real administrator rights in order to run specific programs, simulate opening the console using the command sudo –i... This command will grant you superuser rights with an administrative environment variable.
    • Enter the command sudo passwd root... This will create a password for root, thereby enabling administrative access. See, don't forget this password.
    • Enter sudo -i... Enter your root password when prompted.
    • The icon in the terminal will change from $ on the #indicating that you now have superuser rights.
  5. 5 Grant access sudo to another user. If you are setting up an account for someone who does not currently have administrative access, add their name to the sudo group. To do this, enter usermod -aG sudo username (replace "username" with the correct username).

Method 2 of 2: Enabling Superuser Rights

  1. 1 Press the key combination Ctrl+Alt+Tto open a terminal window. For security reasons (and to avoid crashes), the superuser account is disabled by default. To safely run a command as an administrator, use the sudo or gksudo commands. If you simply must have a separate account with superuser rights (if required by the program used in your company or there will be one person behind this computer), enable superuser rights by entering a few simple commands.
    • Unlocking superuser rights can harm the system, which is why Ubuntu does not recommend doing this.
  2. 2 Enter the command sudo passwd root and press ↵ Enter. You will be asked to create a new password for the superuser. See, don't lose this password.
  3. 3 Enter your password and then click ↵ Enter.
  4. 4 Re-enter the password, then press ↵ Enter. The superuser account will now have a password.
  5. 5 Enter the command su - and press ↵ Enter. Enter the superuser password to open the console.
    • To disable the superuser account, enter the command sudo passwd -dl root.

Tips

  • Try to log in with superuser rights as little as possible. Almost all commands that require superuser rights can be run by the commands sudo or gksudo.
  • Using the command sudo –i you can access the console of another user on the system. To become a Max user, enter sudo –i Maxand then enter your password (not Maxim's password).

Similar articles

  • How to install True Type fonts in Ubuntu
  • How to access Windows files in Ubuntu
  • How to become a Linux superuser
  • How to Install Oracle Java on Ubuntu Linux
  • How to install Oracle Java JDK on Ubuntu Linux
  • How to install Ubuntu
  • How to install Ubuntu in VirtualBox
  • How to install Adobe Flash Player on Ubuntu
  • How to install Oracle Java JRE on Ubuntu Linux