Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How does Linux create a user and set a login password

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly introduces "how to create users and set login passwords in Linux". In daily operation, I believe many people have doubts about how to create users and set login passwords in Linux. Xiaobian consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts about "how to create users and set login passwords in Linux". Next, please follow the editor to study!

Preface

Linux forces users to log in for the first time to change their passwords, which should be the part of user management in RHCE authentication, which is a very basic content. But I forgot, so I have the following record ~

Experiment process 1. Create a user and set the login password [root@qll251 ~] # useradd user01

[root@qll251 ~] # echo "123123" | passwd-- stdin user01

Changing password for user user01.

Passwd: all authentication tokens updated successfully.

2. One command to solve [root@qll251 ~] # chage-d 0 user01

-d 0 user01 sets the user's password to be changed on January 1, 1970, which actually causes the current password to expire immediately so that the password is changed the next time you log in.

3. Verify [root@qll251 ~] # ssh user01@10.43.187.251

User01@10.43.187.251's password:

You are required to change your password immediately (root enforced)

Last login: Mon Jun 1 20:09:10 2020 from 10.43.187.251

WARNING: Your password has expired.

You must change your password now and login again!

Changing password for user user01.

Changing password for user01.

(current) UNIX password:

New password:

Retype new password:

Passwd: all authentication tokens updated successfully.

Connection to 10.43.187.251 closed.

Chage command description

The chage command is used for password utility management, which is used to change the validity period of the account and password.

Command parameters:

Examples of use:

1. Check the validity period of user01 users and passwords

[root@qll251 ~] # chage-l user01

Last password modified: June 01, 2020

Password expiration time: never

Password expiration time: never

Account expiration time: never

The minimum number of days between two password changes: 0

The maximum number of days between two password changes: 99999

Number of days to warn before password expiration: 7

2. Set the password of user01 users to expire 90 days later, and change the password at least 7 days later. The alarm message will be received 30 days before the password expires.

[root@qll251] # chage-M 90-m 7-W 30 user01

After the setting is completed, verify the result:

[root@qll251 ~] # chage-l user01

Last password modified: June 01, 2020

Password expiration date: August 30, 2020

Password expiration time: never

Account expiration time: never

The minimum number of days between two password changes: 7

The maximum number of days between two password changes: 90

Number of days to warn before password expiration: 30

At this point, the study on "how to create a user and set a login password in Linux" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

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.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report