Linux下删除密码

首先,没有GUI工具可以完成这一件事情, 不过使用命令行也是一件很简单的事情。

一下假设当前用户名为shen
首先使用sudo visudo ,然后向文件中间添加

 shen ALL=(ALL) NOPASSWD:ALL

然后执行命令

 sudo passwd -d shen # `whoami`就是当前用户

但是当在终端中间敲下su的时候,依旧是弹出需要密码提示,原因是没有删除管理员的密码,需要做的事情很简单

sudo passwd -d root

参考原文

You can’t do that using the GUI tool, but you can using the terminal.

  1. First, if your user has sudo privileges, you must enable its NOPASSWD option. Otherwise, sudo will ask for a password even when you don’t have one, and won’t accept an empty password.To do so, open the sudoers configuration file with sudo visudo, and add the following line to the file, replacing david with your username:
    david ALL=(ALL) NOPASSWD:ALL

Close the editor to apply the changes, and test the effect on sudo in a new terminal.

  1. Delete the password for your user by running this command:
    sudo passwd -d `whoami`
    原文作者:Martins3
    原文地址: https://www.jianshu.com/p/d816273a636a
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞