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

本文共 2884 字,大约阅读时间需要 9 分钟。

linux中更改用户密码

In this tutorial, we will focus on how you can change a user’s password in Linux. We will delve deeper and see how to force a user to change their password the next time they try logging in. These commands are standard and will work for any Linux distribution.

在本教程中,我们将重点介绍如何在Linux中更改用户密码。 我们将进行更深入的研究,并了解如何在用户下次尝试登录时强制其更改密码。这些命令是标准命令,适用于任何Linux发行版。

Let’s jump right in.

让我们跳进去。

1.更改您的用户密码 (1. Changing your user password)

As a regular user in a Linux system, you can only change your password. The root user is the only user that can change the passwords of other users.

作为Linux系统的普通用户,您只能更改密码。 root用户是唯一可以更改其他用户密码的用户。

The command used for changing users’ password is the passwd command. It is usually followed by the username of the user whose password you want to change i.e.

用于更改用户密码的命令是passwd命令。 通常,其后是要更改其密码的用户的用户名,即

# passwd your_username

For example, if you want to change the password of a user jamie, execute

例如,如果要更改用户jamie的密码,请执行

# passwd jamie

You will be prompted to type your current password and later provide the NEW password and confirm it.

系统将提示您输入当前密码,然后提供新密码并进行确认。

Sample Output

样本输出

When providing a new password , ensure that you use a STRONG and UNIQUE password. A strong password should have the following.

提供新密码时,请确保使用STRONG密码和UNIQUE密码。 强密码应具有以下内容。

  1. It should have a combination of Uppercase, Lowercase, Numeric and Special characters

    它应包含大写,小写,数字和特殊字符的组合
  2. It should have more than 8 Characters

    它应该超过8个字符
  3. It should not contain your biometric details such as name, date of birth, place of residence to mention a few.

    它不应包含您的生物特征详细信息,例如姓名,出生日期,居住地点等。

Passwords are stored in an ecrrypted format in the /etc/gshadow file.

密码以加密格式存储在/etc/gshadow文件中。

2.更改其他用户的Linux密码 (2. Changing Linux password for another user)

As discussed before, only the root user can change other users’ password. So, you need to log in as the root user to do this.

如前所述,只有root用户可以更改其他用户的密码。 因此,您需要以root用户身份登录才能执行此操作。

Once logged in run the command as earlier shown to change a users password

登录后,运行前面显示的命令以更改用户密码

# passwd username

Once again, you will be prompted for the new password and asked to confirm it.

再次,将提示您输入新密码并要求您确认。

Sample Output

样本输出

3.强制用户在下次登录时更改密码 (3. Forcing a user to change password at the Next Login)

Usually, passwords are not set to expire. But, you can force a user to change their password the next time they log in to the Linux system.

通常,密码未设置为过期。 但是,您可以强制用户在下次登录Linux系统时更改其密码。

To do this , use the passwd command with --expire option followed by the username of the user:

为此,请使用带有--expire选项的passwd命令以及用户名:

$ passwd --expire jamie

The next time user logs in with their old password, they will be forced to change the password.

下次用户使用旧密码登录时,将被迫更改密码。

Sample Output

样本输出

That concludes this tutorial on How to change a user’s password in Linux. Your contribution and feedback are most welcome.

到此为止,本教程有关如何在Linux中更改用户密码。 非常欢迎您的贡献和反馈。

翻译自:

linux中更改用户密码

转载地址:http://bnlzd.baihongyu.com/

你可能感兴趣的文章
Android 动态显示和隐藏软键盘
查看>>
raid5什么意思?怎样做raid5?raid5 几块硬盘?
查看>>
【转】how can i build fast
查看>>
null?对象?异常?到底应该如何返回错误信息
查看>>
django登录验证码操作
查看>>
(简单)华为Nova青春 WAS-AL00的USB调试模式在哪里开启的流程
查看>>
图论知识,博客
查看>>
[原创]一篇无关技术的小日记(仅作暂存)
查看>>
20145303刘俊谦 Exp7 网络欺诈技术防范
查看>>
原生和jQuery的ajax用法
查看>>
iOS开发播放文本
查看>>
20145202马超《java》实验5
查看>>
JQuery 事件
查看>>
main(argc,argv[])
查看>>
在线教育工具—白板系统的迭代1——bug监控排查
查看>>
121. Best Time to Buy and Sell Stock
查看>>
hdu 1005 根据递推公式构造矩阵 ( 矩阵快速幂)
查看>>
安装php扩展
查看>>
百度移动搜索主要有如下几类结果构成
查看>>
Python爬虫面试题170道:2019版【1】
查看>>