潮流有货 2025-07-31 14:15 采纳率: 97.8%
浏览 124

问题:su命令切换用户时报错“passwd does not exist or the user entry does not contain all the re”如何解决?

在使用 `su` 命令切换用户时,出现错误提示:“passwd does not exist or the user entry does not contain all the required fields”,通常表明目标用户的账户信息异常。该问题常见于手动编辑 `/etc/passwd` 文件出错、用户账户未正确创建,或系统文件损坏等情况。解决方法包括:检查 `/etc/passwd` 和 `/etc/shadow` 文件中目标用户的条目是否完整、格式是否正确;使用 `pwck` 和 `grpck` 命令验证用户和组文件的完整性;必要时通过 `usermod` 或 `adduser` 重建用户信息。此外,确认目标用户密码已设置且 `/etc/passwd` 中 shell 字段有效,也是排查重点。
  • 写回答

0条回答 默认 最新

    报告相同问题?

    问题事件

    • 创建了问题 7月31日