search
HomeOperation and MaintenanceLinux Operation and MaintenanceWhat is the most powerful account in Linux?

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.

What is the most powerful account in Linux?

#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?

What is the most powerful account in Linux?

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!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
什么是linux设备节点什么是linux设备节点Apr 18, 2022 pm 08:10 PM

linux设备节点是应用程序和设备驱动程序沟通的一个桥梁;设备节点被创建在“/dev”,是连接内核与用户层的枢纽,相当于硬盘的inode一样的东西,记录了硬件设备的位置和信息。设备节点使用户可以与内核进行硬件的沟通,读写设备以及其他的操作。

Linux中open和fopen的区别有哪些Linux中open和fopen的区别有哪些Apr 29, 2022 pm 06:57 PM

区别:1、open是UNIX系统调用函数,而fopen是ANSIC标准中的C语言库函数;2、open的移植性没fopen好;3、fopen只能操纵普通正规文件,而open可以操作普通文件、网络套接字等;4、open无缓冲,fopen有缓冲。

linux中什么叫端口映射linux中什么叫端口映射May 09, 2022 pm 01:49 PM

端口映射又称端口转发,是指将外部主机的IP地址的端口映射到Intranet中的一台计算机,当用户访问外网IP的这个端口时,服务器自动将请求映射到对应局域网内部的机器上;可以通过使用动态或固定的公共网络IP路由ADSL宽带路由器来实现。

什么是linux交叉编译什么是linux交叉编译Apr 29, 2022 pm 06:47 PM

在linux中,交叉编译是指在一个平台上生成另一个平台上的可执行代码,即编译源代码的平台和执行源代码编译后程序的平台是两个不同的平台。使用交叉编译的原因:1、目标系统没有能力在其上进行本地编译;2、有能力进行源代码编译的平台与目标平台不同。

linux中eof是什么linux中eof是什么May 07, 2022 pm 04:26 PM

在linux中,eof是自定义终止符,是“END Of File”的缩写;因为是自定义的终止符,所以eof就不是固定的,可以随意的设置别名,linux中按“ctrl+d”就代表eof,eof一般会配合cat命令用于多行文本输出,指文件末尾。

linux怎么查询mac地址linux怎么查询mac地址Apr 24, 2022 pm 08:01 PM

linux查询mac地址的方法:1、打开系统,在桌面中点击鼠标右键,选择“打开终端”;2、在终端中,执行“ifconfig”命令,查看输出结果,在输出信息第四行中紧跟“ether”单词后的字符串就是mac地址。

linux怎么判断pcre是否安装linux怎么判断pcre是否安装May 09, 2022 pm 04:14 PM

在linux中,可以利用“rpm -qa pcre”命令判断pcre是否安装;rpm命令专门用于管理各项套件,使用该命令后,若结果中出现pcre的版本信息,则表示pcre已经安装,若没有出现版本信息,则表示没有安装pcre。

linux中rpc是什么意思linux中rpc是什么意思May 07, 2022 pm 04:48 PM

在linux中,rpc是远程过程调用的意思,是Reomote Procedure Call的缩写,特指一种隐藏了过程调用时实际通信细节的IPC方法;linux中通过RPC可以充分利用非共享内存的多处理器环境,提高系统资源的利用率。

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment