


The account with the most authority in Linux is "root". Root (root user) is a super administrator account. It is named because it can perform read, write and execution operations on the root directory; it can do anything and use everything in the system, access any files and run anything on the Linux system. Order. Root has all the permissions of the system. If the root password is leaked, the data of all users on the entire computer will be completely stolen.
#The operating environment of this tutorial: linux7.3 system, Dell G3 computer.
The account with the most authority in Linux is "root".
Root, also known as the root user, is the only user in Unix (such as Solaris, AIX, BSD) and UNIX-like systems (such as Linux, QNX, etc.), as well as Android and iOS mobile device systems. Superuser, so named because it can perform read, write, and execute operations on the root directory.
Root is the super administrator account, it can do anything and use everything in the system. It can access any file and run any command on your Linux system.
The greater the ability, the greater the responsibility. The root user gives you complete control over the system, therefore, it should be used with caution. The root user can access system files and run commands that change system configuration. Therefore, a wrong command can destroy the system.
Root has all the permissions of the system. If the root password is leaked, it is enough to cause the entire computer to be completely controlled by the person who steals the root password. Having the root password means owning all the users on this computer. all data.
This is why Ubuntu and other Ubuntu-based distributions lock the root user by default, to save you from unexpected disasters.
For your daily tasks, like moving files in your home directory, downloading files from the Internet, creating documents, etc., you do not need to have root privileges.
Let’s use an analogy to understand it better. Suppose you want to cut a piece of fruit, you can use a kitchen knife. Suppose you want to cut down a tree, you have to use a saw. Now, you could use a saw to cut the fruit, but that wouldn't be wise, would it? _
Does this mean that you cannot be the root user in Ubuntu or cannot use the system with root privileges? No, you can still have root access with the help of sudo (explained in the next section).
Points: For routine tasks, the root user rights are too powerful. This is why it is not recommended to use the root user all the time. You can still use the root user to run special commands.
How to run commands as root user in Ubuntu?
For some system-specific tasks, you will need root privileges. For example. If you want to update Ubuntu via the command line, you cannot run the command as a regular user. It will give permission denied error.
apt update Reading package lists... Done E: Could not open lock file /var/lib/apt/lists/lock - open (13: Permission denied) E: Unable to lock directory /var/lib/apt/lists/ W: Problem unlinking the file /var/cache/apt/pkgcache.bin - RemoveCaches (13: Permission denied) W: Problem unlinking the file /var/cache/apt/srcpkgcache.bin - RemoveCaches (13: Permission denied)
So, how do you run commands as the root user? The simple answer is to add sudo before the command to run it as root.
sudo apt update
Ubuntu and many other Linux distributions use a special program mechanism called sudo. sudo is a program that controls access to running commands as the root user (or other user).
In fact, sudo is a very versatile tool. It can be configured to allow a user to run all commands as root, or just some commands. You can also configure it to run commands using sudo without requiring a password. This topic is quite rich, maybe I will discuss it in detail in another article.
For now, you should know that when you install Ubuntu, you must create a user account. This user account works as an administrator on your system, and according to the default sudo policy in Ubuntu, it can run any command with root user privileges on your system.
The problem with sudo is that running sudo does not require the root user password, but rather the user's own password.
And this is why when you run a command using sudo, you are asked to enter the password of the user who is running the sudo command:
[email protected]:~$ sudo apt update [sudo] password for abhishek:
As you can see in the example above abhishek is trying to use sudo to run the apt update command, and the system asks for abhishek's password.
If you are completely new to Linux, you may be surprised that nothing happens on the screen when you start typing your password in the terminal. This is quite normal as as a default security feature nothing will be displayed on the screen. Not even an asterisk (*). Enter your password and press Enter.
Key Point: To run commands as root in Ubuntu, add sudo before the command. When asked for a password, enter the password for your account. When you enter your password on the screen, you see nothing. Please continue entering your password and press Enter.
如何在 Ubuntu 中成为 root 用户?
你可以使用 sudo 来像 root 用户一样运行命令。但是,在某些情况下,你必须以 root 用户身份来运行一些命令,而你总是忘了在命令前添加 sudo,那么你可以临时切换为 root 用户。
sudo 命令允许你来模拟一个 root 用户登录的 shell ,使用这个命令:
sudo -i
[email protected]:~$ sudo -i [sudo] password for abhishek: [email protected]:~# whoami root
你将注意到,当你切换为 root 用户时,shell 命令提示符从 $(美元符号)更改为 #(英镑符号)。我开个(拙劣的)玩笑,英镑比美元强大。
虽然我已经向你显示如何成为 root 用户,但是我必须警告你,你应该避免作为 root 用户使用系统。毕竟它有阻拦你使用 root 用户的原因。
另外一种临时切换为 root 用户的方法是使用 su 命令:
sudo su
如果你尝试使用不带有的 sudo 的 su 命令,你将遇到 “su authentication failure” 错误。
你可以使用 exit 命令来恢复为正常用户。
exit
如何在 Ubuntu 中启用 root 用户?
现在你知道,root 用户在基于 Ubuntu 发行版中是默认锁定的。
Linux 给予你在系统上想做什么就做什么的自由。解锁 root 用户就是这些自由之一。
如果出于某些原因,你决定启用 root 用户,你可以通过为其设置一个密码来做到:
sudo passwd root
再强调一次,不建议使用 root 用户,并且我也不鼓励你在桌面上这样做。如果你忘记了密码,你将不能再次在 Ubuntu 中更改 root 用户密码。(LCTT 译注:可以通过单用户模式修改。)
你可以通过移除密码来再次锁定 root 用户:
sudo passwd -dl root
相关推荐:《Linux视频教程》
The above is the detailed content of What is the most powerful account in Linux?. For more information, please follow other related articles on the PHP Chinese website!

The five core elements of Linux are: 1. Kernel, 2. Command line interface, 3. File system, 4. Package management, 5. Community and open source. Together, these elements define the nature and functionality of Linux.

Linux user management and security can be achieved through the following steps: 1. Create users and groups, using commands such as sudouseradd-m-gdevelopers-s/bin/bashjohn. 2. Bulkly create users and set password policies, using the for loop and chpasswd commands. 3. Check and fix common errors, home directory and shell settings. 4. Implement best practices such as strong cryptographic policies, regular audits and the principle of minimum authority. 5. Optimize performance, use sudo and adjust PAM module configuration. Through these methods, users can be effectively managed and system security can be improved.

The core operations of Linux file system and process management include file system management and process control. 1) File system operations include creating, deleting, copying and moving files or directories, using commands such as mkdir, rmdir, cp and mv. 2) Process management involves starting, monitoring and killing processes, using commands such as ./my_script.sh&, top and kill.

Shell scripts are powerful tools for automated execution of commands in Linux systems. 1) The shell script executes commands line by line through the interpreter to process variable substitution and conditional judgment. 2) The basic usage includes backup operations, such as using the tar command to back up the directory. 3) Advanced usage involves the use of functions and case statements to manage services. 4) Debugging skills include using set-x to enable debugging mode and set-e to exit when the command fails. 5) Performance optimization is recommended to avoid subshells, use arrays and optimization loops.

Linux is a Unix-based multi-user, multi-tasking operating system that emphasizes simplicity, modularity and openness. Its core functions include: file system: organized in a tree structure, supports multiple file systems such as ext4, XFS, Btrfs, and use df-T to view file system types. Process management: View the process through the ps command, manage the process using PID, involving priority settings and signal processing. Network configuration: Flexible setting of IP addresses and managing network services, and use sudoipaddradd to configure IP. These features are applied in real-life operations through basic commands and advanced script automation, improving efficiency and reducing errors.

The methods to enter Linux maintenance mode include: 1. Edit the GRUB configuration file, add "single" or "1" parameters and update the GRUB configuration; 2. Edit the startup parameters in the GRUB menu, add "single" or "1". Exit maintenance mode only requires restarting the system. With these steps, you can quickly enter maintenance mode when needed and exit safely, ensuring system stability and security.

The core components of Linux include kernel, shell, file system, process management and memory management. 1) Kernel management system resources, 2) shell provides user interaction interface, 3) file system supports multiple formats, 4) Process management is implemented through system calls such as fork, and 5) memory management uses virtual memory technology.

The core components of the Linux system include the kernel, file system, and user space. 1. The kernel manages hardware resources and provides basic services. 2. The file system is responsible for data storage and organization. 3. Run user programs and services in the user space.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

Notepad++7.3.1
Easy-to-use and free code editor
