root無法登陸 :No such file or directory
阿新 • • 發佈:2019-01-08
Question:
-
在Linux圖形介面使用root登陸提示如下:
View Details:
/etc/gdm/PreSession/Default: Registering your session with utmp.
/etc/gdm/PreSession/Default: running:/usr/bin/sessreg -a -u /var/run/utmp -x "/var/gdm/:0.Xservers" -h "" -l ":0" "root"
Localuser:root being added to access control list
No Profile for user 'root' found
/bin/sh:/bin/bash
:No such file or directory
/bin/sh"line 0: exec:/bin/bash
:cannot execute : No such file or directory
2.重啟進入單使用者模式新建普通使用者,可正常登陸,通過該使用者"su - root"提示:":No such file or directory"。
Resolution:
檢視/etc/shadow和/etc/passwd兩個檔案,發現/etc/passwd檔案每行末尾顯示"^M",該檔案為DOS的編碼格式。
我們需要將該檔案變為Linux編碼格式,在單使用者模式下:# dos2unix /etc/passwd /etc/passwd。
重啟主機,登陸正常。
Redhat Case:
https://access.redhat.com/site/solutions/258803