TrumanWong

pwck

Used to verify the integrity of the content and format of system certification files

Supplementary instructions

pwck command is used to verify the integrity of the content and format of the system authentication files /etc/passwd and /etc/shadow.

grammar

pwck(option)(parameter)

Options

-q: only report error information;
-s: Sort files "/etc/passwd" and "/etc/shadow" by user ID;
-r: Run the command in read-only mode;
-R: Check the password file in the specified chroot environment.

Parameters

  • Password file: Specify the path to the password file;
  • Shadow file: Specify the path of the shadow file.

Example

pwck
user 'ftp': directory '/var/ftp' does not exist
pwck: no changes

After executing the pwck command, some warnings are displayed, indicating that the home directory /var/spool/lpd of the user lp does not exist. To solve this problem, you have several options:

  1. If you are sure that these users will not be used, you may consider using the userdel command to delete these users.
  2. If these users need to be used, you should create the corresponding directories. For example, you can use the following command:
# Create a directory
sudo mkdir /var/ftp
# Assign directory ownership to the corresponding user
sudo chown ftp:ftp /var/ftp
  1. If the software packages corresponding to these users have not been installed, you may consider installing them. Package managers (such as yum or apt) usually create the necessary users and directories automatically.