linux中更改用户密码_如何在Linux中更改用户密码
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
密码。 强密码应具有以下内容。
- It should have a combination of Uppercase, Lowercase, Numeric and Special characters它应包含大写,小写,数字和特殊字符的组合
- It should have more than 8 Characters它应该超过8个字符
- 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中更改用户密码。 非常欢迎您的贡献和反馈。
翻译自: https://www.journaldev.com/28658/change-user-password-linux
linux中更改用户密码
linux中更改用户密码_如何在Linux中更改用户密码相关推荐
- linux更改root密码_如何在Linux中更改root密码
linux更改root密码 Let's go over the simple commands to change the root password in Linux. Linux root ref ...
- 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 ...
- wordpress默认密码_如何在WordPress中为新用户设置默认管理员配色方案
wordpress默认密码 One of the most talked about feature of WordPress 3.8 is the new admin interface. It i ...
- shell中竖线的作用_如何在 Linux 中安装、配置和使用 Fish Shell?
每个 Linux 管理员都可能听到过 shell 这个词.你知道什么是 shell 吗? 你知道 shell 在 Linux 中的作用是什么吗? Linux 中有多少个 shell 可用? -- Ma ...
- 如何在linux系统下修改mysql密码_如何在linux下修改mysql数据库密码?linux修改数据库密码的方法...
本篇文章给大家带来的内容是介绍如何在linux下修改mysql数据库密码?linux修改数据库密码的方法.有一定的参考价值,有需要的朋友可以参考一下,希望对你们有所帮助. Linux下修改Mysql的 ...
- centos root密码_如何在CentOS中恢复丢失的root密码
centos root密码 In Linux, when you forget your account password, you can easily reset it using a root ...
- linux中设置环境变量_如何在Linux中设置环境变量
linux中设置环境变量 Wondering how to set environment variables in Linux? This is exactly what we'll be doin ...
- linux删除用户所有信息_如何在Linux上删除用户(以及删除所有跟踪)
linux删除用户所有信息 Fatmawati Achmad Zaenuri/ShutterstockFatmawati Achmad Zaenuri / Shutterstock Deleting ...
- kali如何取得超级用户权限_如何在 Ubuntu 上为用户授予和移除 sudo 权限 | Linux 中国...
在这个简短的教程中,我们将介绍如何将普通用户添加到 sudo 组以及移除给定的权限,使其成为普通用户.-- Sk 如你所知,用户可以在 Ubuntu 系统上使用 sudo 权限执行任何管理任务.在 L ...
最新文章
- html默认选定,html默认代码
- 创建windows窗口并且获得窗口句柄
- JMeter Sampler之BeanShellSampler的使用
- python 回溯法 01背包问题_Python回溯法解决01背包问题
- PHP操作文件和目录的相关函数
- es mysql 同步插件_[es和数据库怎么同步]mysql与elasticsearch实时同步常用插件及优缺点对比(ES与关系型数据库同步)...
- 【图像处理】基于matlab GUI打靶仿真系统【含Matlab源码 1043期】
- 从sql2016导出数据库到sql2014
- 变量、函数、类等编程时常用英文命名和缩写
- 常用时序数据地址 MTGNN
- 云中和花木_王者荣耀:体验服英雄重大调整,云中君成野王,妲己射程加强,花木兰重回巅峰...
- TOMCAT HTPPS
- SEO外推福利:外链高收录平台与外链类型分析
- wordpress install.php 500,安装WordPress出现500错误的解决办法 | Wopus
- 服务器系统获取最高权限,webshell+serv-u获取系统最高权限
- Java实现规则几何图形问题求解
- 消费提示:2012春运火车票 网上订票攻略
- dy火山设备id注册激活
- 计算机打开管理工具空白,win7系统下打开设备管理器空白的解决方法
- SPN/MTN标准及其进展是什么情况?