How to achieve the first SSH login for Linux users who need to reset a new password

888u

Last update at :2024-06-29,Edit by888u

Generally, after we choose a VPS server, we reinstall the system or when we purchase a new one, the merchant automatically activates the default system and we set the password ourselves or the merchant gives us a random password to log in directly using SSH. But have we found that some merchants require us to reset a new password when I log in to SSH for the first time before I can enter?

Similarly, if we manage multiple people's permissions in the server and help a specified user set password permissions, we initialize a new password. If the user logs in to SSH for the first time, the best way is Log in to remind him to change his new password, which seems a little more humane. So how is it achieved? Here the snail search solutions are sorted out.

First, add new users

useradd laozuo

Add a new user, the name of the user here is defined by ourselves.

Second, set a new user password

passwd laozuo

Here we need to set an initial password for the newly created user.

Changing password for user laozuo.New password:Retype new password:passwd: all authentication tokens updated successfully.

We can see that there are two prompts that require you to enter the password twice.

Third, lock the account

usermod -L laozuo

Here we need to lock the current user account.

Fourth, forced user account expiration

chage -d 0 laozuo

Fifth, unlock user account

usermod -U laozuo

In this way, we try to log in with a new account to see if there is a prompt to reset a new password after logging in for the first time.

That's the effect.

Recommended site search: US server, cn domain name price, US host network, domain name registration information query, vps foreign server, free static space, free virtual space, Singapore server, org domain name, Korean cn2 server,

How to achieve the first SSH login for Linux users who need to reset a new password

All copyrights belong to 888u unless special state
取消
微信二维码
微信二维码
支付宝二维码