博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
linux更改root密码_如何在Linux中更改root密码
阅读量:2530 次
发布时间:2019-05-11

本文共 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命令。

whoamI
whoami
我是谁

使用sudo以root身份运行命令 (Using sudo to run commands as root)

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.

此后,系统将要求用户输入密码。 接受密码后,系统将运行命令。

在Linux中使用passwd命令更改root密码 (Using the passwd command to change root password in Linux)

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。

Passwd Change
Passwd Change
密码更改

Output window will inform you upon performing a successful update.

输出窗口将在成功执行更新后通知您。

修改用户密码 (Changing a user’s password)

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
Changing User Password
Changing User pwd
更改用户密码

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特权的情况下更改自己的密码。

User Changing Its Own Password
User Changing Its Own Password
用户更改自己的密码

Note that the new password and the old password can’t be similar.

请注意,新密码和旧密码不能相似。

结论 (Conclusion )

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/

你可能感兴趣的文章
小D课堂-SpringBoot 2.x微信支付在线教育网站项目实战_5-8.用户模块开发之保存微信用户信息...
查看>>
Linux下Nginx安装
查看>>
LVM扩容之xfs文件系统
查看>>
Hbase记录-client访问zookeeper大量断开以及参数调优分析(转载)
查看>>
代码片段收集
查看>>
vue-cli3创建项目时报错
查看>>
输入1-53周,输出1-53周的开始时间和结束时间
查看>>
实验二
查看>>
shell——按指定列排序
查看>>
crash 收集
查看>>
507 LOJ 「LibreOJ NOI Round #1」接竹竿
查看>>
UI基础--烟花动画
查看>>
2018. 2.4 Java中集合嵌套集合的练习
查看>>
精通ASP.NET Web程序测试
查看>>
vue 根据不同属性 设置背景
查看>>
51Nod1601 完全图的最小生成树计数 Trie Prufer编码
查看>>
Codeforces 1110D. Jongmah 动态规划
查看>>
android驱动在win10系统上安装的心酸历程
查看>>
优雅的程序员
查看>>
oracle之三 自动任务调度
查看>>