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
我是谁

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

Sudo or ‘Superuser Do’ gives user root privileges. It is used to run a command as the root. This can be done as:

Sudo或“ 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 passwd command.

要更改密码,我们可以使用passwd命令 。


$ 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
密码更改

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 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
用户更改自己的密码

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命令提供更改根密码的访问权限。

翻译自: https://www.journaldev.com/41310/change-root-password-linux

linux更改root密码

linux更改root密码_如何在Linux中更改root密码相关推荐

  1. python如何更改entry属性_如何在Python3中更改Gtk3 Entry文本颜色?

    我在我的应用程序中有一个Gtk.Entry()列表,我想改变其中一些文本的颜色. 我尝试了以下方法: #!/usr/bin/python3 # Filename: mywindow.py from g ...

  2. python绘图背景透明_如何在 Matplotlib 中更改绘图背景

    介绍Matplotlib是Python中使用最广泛的数据可视化库之一.无论是简单还是复杂的可视化项目,它都是大多数人的首选库.在本教程中,我们将研究如何在Matplotlib中更改绘图的背景.导入数据 ...

  3. python画图修改背景颜色_如何在 Matplotlib 中更改绘图背景的实现

    介绍 Matplotlib是Python中使用最广泛的数据可视化库之一.无论是简单还是复杂的可视化项目,它都是大多数人的首选库. 在本教程中,我们将研究如何在Matplotlib中更改绘图的背景. 导 ...

  4. chrome修改摄像头权限_如何在Chrome中更改网站的摄像头和麦克风权限

    chrome修改摄像头权限 Google Chrome lets you manage which individual sites can have access to your microphon ...

  5. mac app图标简单制作_如何在Mac中更改App图标

    mac app图标简单制作 Sometimes, apps icon change but we like the older icon. Thankfully, it's very easy to ...

  6. linux中更改用户密码_如何在Linux中更改用户密码

    linux中更改用户密码 In this tutorial, we will focus on how you can change a user's password in Linux. We wi ...

  7. linux改sudo密码错误,如何在Ubuntu中更改sudo密码

    如果您是一个新的Ubuntu管理用户,您可能想知道如何通过bash shell或命令行更改Ubuntu Linux服务器中的密码.毕竟,更改任何用户的密码都是一个很好的安全实践,尤其是超级用户,他们可 ...

  8. 如何在linux系统下修改mysql密码_如何在linux下修改mysql数据库密码?linux修改数据库密码的方法...

    本篇文章给大家带来的内容是介绍如何在linux下修改mysql数据库密码?linux修改数据库密码的方法.有一定的参考价值,有需要的朋友可以参考一下,希望对你们有所帮助. Linux下修改Mysql的 ...

  9. linux 更改ssh端口_如何在Linux中更改SSH端口-简易指南

    linux 更改ssh端口 The default port on SSH is 22. But for security reasons, it's a good idea to change SS ...

最新文章

  1. CentOS7.4 安装mongodb
  2. python第三方库安装-多种方式
  3. Java 基本数据类型 sizeof 功能
  4. Retrofit2/OkHttp 重写覆盖headers 与 不重写覆盖Headers
  5. 小程序开发过程注意事项
  6. 数字化转型知识方法系列之五:数字化转型战略
  7. Git GUI,Git Bash,Git CMD标签之间的区别
  8. matlab 文件列表,如何從Matlab寫入多個列表到同一個excel文件?
  9. 容我说下windows linux macosx
  10. Python打包文件夹(zip/tar/tar.gz)
  11. unity5 人皮渲染 Skin Shading
  12. C# mvc4.0 MD5测试
  13. 移动WEB开发之Safari、QQ、UC、360浏览器的私有Meta属性
  14. python csv 格式文件导出 中文乱码问题解决方法
  15. elastic-Job配置参数详细解释
  16. 50Ω阻抗问题详解及射频电路设计中的阻抗匹配
  17. 下载SE78里面的图片
  18. win7安装OneNote
  19. 使用在线报表设计器如何制作数据填报模板(efreport.com报表工具)
  20. springMVC 解决 “because it is included into a circular dependency(循环导入依赖)” 的问题

热门文章

  1. POJ 1050 To the Max (最大子矩阵和)
  2. poj 2318 TOYS
  3. 坑爹系列:sizeof运算符
  4. 上传并解析XML文件
  5. .Net 如何限制用户登录(转)
  6. 法拉利杀手Koenigsegg CCX
  7. [转载] boost python numpy_boost.python 与 boost.numpy安装的一些注意事项
  8. [转载] python开源人工智能项目_推荐 10 个饱受好评且功能独特的开源人工智能项目
  9. [转载] C语言C++指针与java中引用的一点对此
  10. 端口截听实现端口隐藏 嗅探与攻击