From fa7dcc18c59ab8d7c495ece6b672df57cf4c48e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91?= Date: Fri, 27 May 2022 18:17:42 +0800 Subject: [PATCH] Translated --- ...do Password In Ubuntu 22.04 - 20.04 LTS.md | 125 ------------------ ...do Password In Ubuntu 22.04 - 20.04 LTS.md | 125 ++++++++++++++++++ 2 files changed, 125 insertions(+), 125 deletions(-) delete mode 100644 sources/tech/20220518 How To Reset Sudo Password In Ubuntu 22.04 - 20.04 LTS.md create mode 100644 translated/tech/20220518 How To Reset Sudo Password In Ubuntu 22.04 - 20.04 LTS.md diff --git a/sources/tech/20220518 How To Reset Sudo Password In Ubuntu 22.04 - 20.04 LTS.md b/sources/tech/20220518 How To Reset Sudo Password In Ubuntu 22.04 - 20.04 LTS.md deleted file mode 100644 index 0d21ba5f9f..0000000000 --- a/sources/tech/20220518 How To Reset Sudo Password In Ubuntu 22.04 - 20.04 LTS.md +++ /dev/null @@ -1,125 +0,0 @@ -[#]: subject: "How To Reset Sudo Password In Ubuntu 22.04 / 20.04 LTS" -[#]: via: "https://ostechnix.com/how-to-reset-sudo-password-in-ubuntu-20-04-lts/" -[#]: author: "sk https://ostechnix.com/author/sk/" -[#]: collector: "lkxed" -[#]: translator: "robsean" -[#]: reviewer: " " -[#]: publisher: " " -[#]: url: " " - -How To Reset Sudo Password In Ubuntu 22.04 / 20.04 LTS -====== -Reset Forgotten Root Password In Ubuntu - -This brief guide explains how to reset sudo password in Ubuntu 22.04 and 20.04 LTS desktop and server editions from rescue mode. - -### Introduction - -When **[installing Ubuntu][1]**, a new user will be created with sudo privileges to perform all sorts of administrative tasks. - -If your Ubuntu system have multiple sudo users, you can easily reset the forgotten password of a sudo user or administrative user from another sudo user's account. - -What If you have only one sudo user and you lost the password? No problem! It is very easy to recover forgotten sudo user password in Ubuntu from the **"rescue"** or **"single user"** mode. - -This guide has been officially tested on Ubuntu 22.04 and 20.04 LTS editions, however the steps given below are same for other Ubuntu versions and derivatives. - -### Reset Sudo Password In Ubuntu 22.04 / 20.04 LTS - -First, boot your Ubuntu system into rescue mode to reset a sudo user's password as described in the link below. - -> [How To Boot Into Rescue Mode Or Emergency Mode In Ubuntu 22.04 /  20.04 / 18.04][2] - -After you entered into the rescue mode, mount the root (**/**) file system in read/write mode by running the following command: - -``` -# mount -n -o remount,rw / -``` - -Now, reset the sudo user's password using **"passwd"** command: - -``` -# passwd ostechnix -``` - -Here, **"ostechnix"** is the sudo user. Replace it with your own user name. - -Enter the password twice: - -``` -New password: -Retype new password: -passwd: password updated successfully -``` - -![Reset Sudo Password In Ubuntu 22.04 / 20.04 LTS][3] - -That's it. We have reset the sudo user password. If you have followed the **Method 1** to enter into rescue mode as described in the above link, press **“Ctrl+d”** to boot into normal mode. Alternatively, you can type any one of the following commands to boot into normal mode. - -``` -# systemctl default -``` - -Or, - -``` -# exit -``` - -If you want to reboot the system instead of booting into normal mode, enter: - -``` -# systemctl reboot -``` - -If you have followed the **Method 2** to enter into rescue mode as described in the above link, type: - -``` -# exit -``` - -You will go back to the recovery menu. Choose "**Resume normal boot**" and hit ENTER key. - -![Boot Into Normal Mode In Ubuntu][4] - -Again, choose OK and press ENTER to continue booting into normal mode: - -![Exit Recovery Mode And Boot Into Normal Mode][5] - -You can now use the new sudo password when running administrative commands. - -##### What If I Forgot Both Username And Password? - -If you forget the username, you can easily list the available users in your Linux system from the rescue mode using command: - -``` -# cat etc/passwd -``` - -Sample output from my Ubuntu 22.04 system: - -``` -[...] -ostechnix:x:1000:1000:Ostechnix,,,:/home/ostechnix:/bin/bash -[...] -``` - -Well, you now have the user name. Just follow the aforementioned steps to reset the user's password. - --------------------------------------------------------------------------------- - -via: https://ostechnix.com/how-to-reset-sudo-password-in-ubuntu-20-04-lts/ - -作者:[sk][a] -选题:[lkxed][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://ostechnix.com/author/sk/ -[b]: https://github.com/lkxed -[1]: https://ostechnix.com/install-ubuntu-desktop/ -[2]: https://ostechnix.com/how-to-boot-into-rescue-mode-or-emergency-mode-in-ubuntu-18-04/ -[3]: https://ostechnix.com/wp-content/uploads/2022/05/Reset-Sudo-Password-In-Ubuntu.png -[4]: https://ostechnix.com/wp-content/uploads/2020/05/Boot-into-normal-mode-in-Ubuntu.png -[5]: https://ostechnix.com/wp-content/uploads/2020/05/Booting-into-normal-mode-from-rescue-mode-in-Ubuntu.png diff --git a/translated/tech/20220518 How To Reset Sudo Password In Ubuntu 22.04 - 20.04 LTS.md b/translated/tech/20220518 How To Reset Sudo Password In Ubuntu 22.04 - 20.04 LTS.md new file mode 100644 index 0000000000..63c1703c11 --- /dev/null +++ b/translated/tech/20220518 How To Reset Sudo Password In Ubuntu 22.04 - 20.04 LTS.md @@ -0,0 +1,125 @@ +[#]: subject: "How To Reset Sudo Password In Ubuntu 22.04 / 20.04 LTS" +[#]: via: "https://ostechnix.com/how-to-reset-sudo-password-in-ubuntu-20-04-lts/" +[#]: author: "sk https://ostechnix.com/author/sk/" +[#]: collector: "lkxed" +[#]: translator: "robsean" +[#]: reviewer: " " +[#]: publisher: " " +[#]: url: " " + +如何在 Ubuntu 22.04 / 20.04 LTS 中重新设置 sudo 密码 +====== +在 Ubuntu 中重新设置已忘记的 root 用户的密码 + +这篇简单的指南将向你解释,如何在 Ubuntu 22.04 好 20.04 LTS 桌面环境中,以及从服务器版本中的 恢复rescue 模式中重新设置 sudo 密码。 + +### 介绍 + +在 **[安装 Ubuntu][1]** 时,新创建的一个用户将会带有 sudo 权限,用以执行各种各样的管理任务。 + +如果你的 Ubuntu 系统有多个 sudo 用户,你能够从另外一个 sudo 用户的账号下,轻松地重新设置所忘记的一个 sudo 用户或管理员用户的密码。 + +如果你只有一个 sudo 用户,并且忘记了密码怎么办?没有问题! 从 Ubuntu 的 **恢复rescue** 或 **单一用户single user**** 模式中恢复 sudo 用户密码很容易。 + +虽然这篇指南是在 Ubuntu 22.04 和 20.04 LTS 版本上进行的正式测试,不过,下面给定的步骤对于其它的 Ubuntu 版本和衍生版本来说是相同的。 + +### 在 Ubuntu 22.04 / 20.04 LTS 中重新设置 sudo 密码 + +首先,启动你的 Ubuntu 系统到 **恢复rescue** 模式下,来重新设置一个 sudo 用户的密码,如下面的链接所述。 + +> [如何启动到 Ubuntu 22.04 /  20.04 / 18.04 的 恢复rescue 模式 或 急救Emergency 模式 ][2] + +在吗进入到 **恢复rescue** 模式下,通过运行下面的命令,以读/写的模式挂载 root (**/**) 文件系统: + +``` +# mount -n -o remount,rw / +``` + +现在,使用 **"passwd"** 命令来重新设置 sudo 用户的密码: + +``` +# passwd ostechnix +``` + +在这里,**"ostechnix"** 是 sudo 用户的名称。 使用你自己的用户名称来替换掉它。 + +输入两次密码: + +``` +New password: +Retype new password: +passwd: password updated successfully +``` + +![Reset Sudo Password In Ubuntu 22.04 / 20.04 LTS][3] + +就这样。我们已经重新设置 sudo 用户密码。如果你按照上面链接所述的 **方法 1** 来进入到 **恢复rescue** 模式,按下 **“Ctrl+d”** 组合键来启动到正常模式。或者,你也可以输入下面的任意一个命令来启动到正常模式。 + +``` +# systemctl default +``` + +或, + +``` +# exit +``` + +如果你想重新启动系统,而不是启动到正常模式,输入: + +``` +# systemctl reboot +``` + +如果你已经按照上面链接所述的 **方法 2** 进入到恢复rescue 模式,输入: + +``` +# exit +``` + +你将返回到 恢复菜单recovery menu 。 现在 "**恢复正常启动Resume normal boot**" ,并按下 回车ENTER 键。 + +![Boot Into Normal Mode In Ubuntu][4] + +在强调一次,选择 确定OK 按钮,并按下 回车ENTER 按键来继续启动到正常模式: + +![Exit Recovery Mode And Boot Into Normal Mode][5] + +现在,你在运行管理命令时可以使用新的 sudo 密码。 + +##### 如果我把用户名称和密码都忘了怎么办? + +如果你忘记了用户名称,在 恢复rescue 模式下,你可以很容易地列出你的 Linux 系统中的用户名称,使用目录: + +``` +# cat etc/passwd +``` + +来自我 Ubuntu 22.04 系统的输出示例: + +``` +[...] +ostechnix:x:1000:1000:Ostechnix,,,:/home/ostechnix:/bin/bash +[...] +``` + +好了,现在,你找到用户名称了。只需要按照上面的步骤来重新设置用户的密码即可。 + +-------------------------------------------------------------------------------- + +via: https://ostechnix.com/how-to-reset-sudo-password-in-ubuntu-20-04-lts/ + +作者:[sk][a] +选题:[lkxed][b] +译者:[robsean](https://github.com/robsean) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://ostechnix.com/author/sk/ +[b]: https://github.com/lkxed +[1]: https://ostechnix.com/install-ubuntu-desktop/ +[2]: https://ostechnix.com/how-to-boot-into-rescue-mode-or-emergency-mode-in-ubuntu-18-04/ +[3]: https://ostechnix.com/wp-content/uploads/2022/05/Reset-Sudo-Password-In-Ubuntu.png +[4]: https://ostechnix.com/wp-content/uploads/2020/05/Boot-into-normal-mode-in-Ubuntu.png +[5]: https://ostechnix.com/wp-content/uploads/2020/05/Booting-into-normal-mode-from-rescue-mode-in-Ubuntu.png