id: cannot find name for user ID xxx

root用户登录显示正常但以普通用户登录时或执行whoami时报错,命令:su pd2030(或者whoami)。

报类似如下错误:

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

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

原因:

/etc/passwd和/etc/group other权限太小

解决:

修改权限这两个文件的other权限:

chmod o+r /etc/passwd
chmod o+r /etc/group 

 

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章