id: cannot find name for user ID xxx处理办法

时间:2022-05-22 07:42:14

一、现像

root用户登录显示正常但以普通用户登录时报类似如下错误:

id: cannot find name for user ID 500
id: cannot find name for group ID 500
id: cannot find name for user ID 500

然后原本应显示用户名的位置被“I have no name!”代替。

二、原因

这个问题是因为普通用户没有权限读取/etc/passwd和/etc/group文件造成,添加权限即可。

三、处理办法

chmod 644 /etc/passwd
chmod 644 /etc/group

四、处理示例

如下是我本机的测试截图

id: cannot find name for user ID xxx处理办法

参考:

http://blog.csdn.net/andy572633/article/details/47296863