Get the App
SLTechnology News&Howtos  ›  Network Security  › 

How to use passwd

Shulou Source: shulou.com Published: 2022-06-01 10:36:09 11月08日 Update

Passwd (option) (parameter)

Options-

-d: delete the password and only the system administrator can use it

-f: enforcement

-k: the setting can only be updated after the password expires.

-l: lock the password

-s: lists the information about the password, which can only be used by the system administrator

-u: unlock the locked account

A tool for automatically generating passwords: mkpasswd

The default command does not exist to install the package

Yum install-y expect

View mkpasswd parameter settings

Command parameters:

-l # (length definition of password, default is 9)

-d # (number of numbers, default is 2)

-c # (number of lowercase characters, default is 2)

-C # (number of uppercase characters, default is 2)

-s # (number of special characters, default is 1)

-v (details.)

-p prog (program sets password, default is passwd)

Example 1: generate a 12-bit password

Mkpasswd-l 12

Example 2: generate a 12-digit password with 5 digits without a string

Mkpasswd-l 12-d 5-s 0

Example 3: how to set a password for a user in a script

Passwd-stdin lizheng

Tags: Password number character parameter generation command number manager system management method special information only uppercase string lowercase tool user program Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Huawei MariaDB vpn Microsoft Docker