Linux su - root无法登陆 :No such file or directory
2013-08-26 09:26 陈尚华 阅读(3193) 评论(0) 编辑 收藏 举报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