歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> Linux教程 >> Redhat Linux 6.4 chown: invalid user: `root:root`錯誤 無法進入系統

Redhat Linux 6.4 chown: invalid user: `root:root`錯誤 無法進入系統

日期:2017/2/28 13:43:56   编辑:Linux教程

1、問題

發現RedHat Linux 6.4主機名消失[I have a no name!@localhost桌面],當時急著用虛擬機以為是出了什麼錯誤,重啟一下應該就可以了。但是結果另人很不愉快,error surface again!錯誤類似下圖

chown: invalid user: `root:root`

init1 rcs post-stop process (1494) terminated with status 1

2、分析

chown: invalid user: `root:root',經查閱資料,其可能是無意間改動了/etc/passwd文件,/etc/passwd文件第一行就是root:x:0:0------------,仔細想想也就etc/passwd文件與root關聯最緊密,有可能是在實驗時不小心改動passwd文件。以後遇到invalid user error類似的問題,第一時間應該聯想到的就是/etc/passwd文件。

3、解決方法

(1)通過鏡像進入到救援模式:Rescue installed system--->English---->us---->yes(network interface)---->OK-->Continue--->ok--->shell Start shell

(2)chroot /mnt/sysimage/

(3) 先是cat /etc/passwd 並未發現異常,ls /etc/pass* 發現多一個passwd-文件

[root@localhost Desktop]# ls /etc/pass*

/etc/passwd /etc/passwd- /etc/passwd.bak

rm -rf /etcpasswd- #刪除該文件

(4)passwd文件改完後,重啟遇到relabel selinux policy。到此界面並且多次自動重啟,後得知可能是selinux下的configure文件改動所致。就又重新改了一個模式,然後就可以正常進入系統。

4、正常進入系統後做快照,養成一個BACKUP的好習慣。

Copyright © Linux教程網 All Rights Reserved