Linux command
pwck 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Check password file integrity
pwck
Check specific files
pwck [/etc/passwd] [/etc/shadow]
Read-only check
pwck -r
Quiet mode
pwck -q
说明
pwck verifies the integrity of /etc/passwd and /etc/shadow files by checking for proper formatting, valid field values, and internal consistency. It detects problems like duplicate usernames, invalid UIDs/GIDs, missing home directories, and entries that don't match between the password and shadow files. By default pwck prompts to delete invalid entries, but the -r flag runs in read-only mode for auditing without making changes. The command is part of shadow-utils and is typically run by administrators after manual edits to password files or as part of system health checks.
参数
- -r
- Read-only mode.
- -q
- Quiet output.
- -s
- Sort by UID.
FAQ
What is the pwck command used for?
pwck verifies the integrity of /etc/passwd and /etc/shadow files by checking for proper formatting, valid field values, and internal consistency. It detects problems like duplicate usernames, invalid UIDs/GIDs, missing home directories, and entries that don't match between the password and shadow files. By default pwck prompts to delete invalid entries, but the -r flag runs in read-only mode for auditing without making changes. The command is part of shadow-utils and is typically run by administrators after manual edits to password files or as part of system health checks.
How do I run a basic pwck example?
Run `pwck` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -r do in pwck?
Read-only mode.