本文共 2975 字,大约阅读时间需要 9 分钟。
linux更改root密码
Let’s go over the simple commands to change the root password in Linux. Linux root refers to a special type of user account that has complete unrestricted access to the system.
让我们看一下简单的命令来更改Linux中的root密码。 Linux root是指一种特殊类型的用户帐户,该帐户具有对系统的完全不受限制的访问权限。
Think of it as a top government security agent with a high clearance level. Usually, users are not allowed to run certain commands without root-level clearance or privilege as it is called in Linux.
可以将其视为具有较高通关水平的顶级政府安全机构。 通常,不允许用户在没有root级权限或特权的情况下运行某些命令,就像在Linux中那样。
Linux does this so that a user doesn’t accentually run a command that can cause unwanted loss of data. For example, a user can’t modify most of the files in the /etc directory without first gaining root or sudo permissions.
Linux这样做是为了使用户不会过分地运行会导致不必要的数据丢失的命令。 例如,用户必须先获得root或sudo权限,才能修改/ etc目录中的大多数文件。
To display the current user, use the whoami command.
要显示当前用户,请使用whoami命令。
or ‘Superuser Do’ gives user root privileges. It is used to run a command as the root. This can be done as:
或“ Superuser Do”赋予用户root特权。 它用于以根用户身份运行命令。 这可以通过以下方式完成:
$ sudo command
After this, the system will ask the user for the password. After accepting the password the system will run the command.
此后,系统将要求用户输入密码。 接受密码后,系统将运行命令。
To change the password we can use the .
要更改密码,我们可以使用 。
$ sudo passwd root
After hitting enter. The system will ask you for the existing root password. Type in the password and hit enter. Now the system will ask you to pick a new password. Retype the new password two times for double-checking and press enter.
点击后进入。 系统将询问您现有的root密码。 输入密码,然后按Enter。 现在,系统将要求您选择一个新密码。 再次输入新密码两次以进行再次确认,然后按Enter。
Output window will inform you upon performing a successful update.
输出窗口将在成功执行更新后通知您。
As a root user, you can change the password of other users in the system. Knowing the name of the user is sufficient to change the password.
作为root用户,您可以更改系统中其他用户的密码。 知道用户名就足以更改密码。
$ passwd user
In this example, I have created a user and changed the password for the user. I was able to do this without sudo as I am currently the root.
在此示例中,我创建了一个用户并更改了该用户的密码。 我能够在没有sudo的情况下执行此操作,因为我目前是root。
A user can change their own password without root privileges.
用户可以在没有root特权的情况下更改自己的密码。
Note that the new password and the old password can’t be similar.
请注意,新密码和旧密码不能相似。
Linux requires normal users to use sudo to get root privileges. Linux protects users from making serious unwanted errors by giving certain permissions only to the root user. Access to the root user is password protected. Sudo command gives access to change the root password.
Linux要求普通用户使用sudo来获得root特权。 Linux通过仅向root用户授予某些权限来保护用户避免造成严重的意外错误。 对root用户的访问受密码保护。 sudo命令提供更改根密码的访问权限。
翻译自:
linux更改root密码
转载地址:http://boozd.baihongyu.com/