In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
In this article, the editor introduces in detail "how to use the Linux chage command", the content is detailed, the steps are clear, and the details are handled properly. I hope this article "how to use the Linux chage command" can help you solve your doubts.
Introduction to the linux chage command:
The chage command is used for password utility management, which is the validity period for changing accounts and passwords. It can change the validity period of the account and password. The description of the chage command is as follows:
The chage command changes the number of days between password changes and the date of the last password change. This information is used by the system to determine when a user must change his/her password
Command syntax:
Chage [options] user
Command parameters:
Parameters.
Description
-d
Specify the date when the password was last modified
-e
The date on which the password expires, after which this account will not be available. 0 means it expires immediately, and-1 means it never expires.
-h
Display help information and exit
-I
The number of days after the password expires and the account is locked
-l
List the user and the validity period of the password
-m
The minimum number of days that the password can be changed. Zero means that the password can be changed at any time.
-m
The maximum number of days that the password remains valid.
-w
The number of days before the password expires that the warning message is received in advance.
Examples of use:
1: view help information for the chage command
[root@db-server ~] # man chage
[root@db-server ~] # info chage
[root@db-server] # chage-h
Usage: chage [options] user
Options:
-d,-- lastday last_day set last password change to last_day
-e-- expiredate expire_date set account expiration date to expire_date
-h,-- help display this help message and exit
-I-- inactive inactive set password inactive after expiration
To inactive
-l,-- list show account aging information
-m,-- mindays min_days set minimum number of days before password
Change to min_days
-m,-- maxdays max_days set maximim number of days before password
Change to max_days
-W,-- warndays warn_days set expiration warning days to warn_days
2: check the validity period of mysql users and passwords
[root@db-server ~] # chage-l mysql
Last password change: mar 26, 2015
Password expires: never
Password inactive: never
Account expires: never
Minimum number of days between password change:-1
Maximum number of days between password change:-1
Number of days of warning before password expires:-1
[root@db-server ~] #
3: set the password of mysql users to expire 60 days later, and change the password at least 7 days later. The alarm message will be received 7 days before the password expires.
[root@db-server] # chage-m 60-m 7-w 7 mysql
You have new mail in / var/spool/mail/root
[root@db-server ~] # chage-l mysql
Last password change: mar 26, 2015
Password expires: may 25, 2015
Password inactive: never
Account expires: never
Minimum number of days between password change: 7
Maximum number of days between password change: 60
Number of days of warning before password expires: 7
[root@db-server ~] #
Clip_image001
4: force new users to change their passwords when they log in for the first time
[root@db-server home] # useradd test
[root@db-server home] # passwd test
Changing password for user test.
New unix password:
Retype new unix password:
Passwd: all authentication tokens updated successfully.
[root@db-server home] # chage-d 0 test
You have new mail in / var/spool/mail/root
[root@db-server home] # chage-l test
Last password change: password must be changed
Password expires: never
Password inactive: never
Account expires: never
Minimum number of days between password change: 0
Maximum number of days between password change: 99999
Number of days of warning before password expires: 7
Next, I would like to introduce the linux chage command.
Function: modify the validity period of account and password
Usage: chage [- l] [- m mindays] [- m maxdays] [- I inactive] [- e expiredate] [- w warndays] [- d lastdays] username
Parameters:
-l: list the user's and the validity period of the password
-m: the minimum number of days to change the password
-m: the maximum number of days to change the password
-I: the number of days that the account is locked after the password expires
-d: specify the date on which the password was last modified
-e: validity period. 0 means immediate expiration, and-1 means never expire.
-w: the number of days before the password expires
Read here, this "how to use Linux chage command" article has been introduced, want to master the knowledge of this article also need to practice and use to understand, if you want to know more about the article, welcome to follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.