Cannot su in to user accounts. Error "No such file or directory"

Solution Verified - Updated -


  • Red Hat Enterprise Linux 5.3


Customer trying to su as root user accounts and it failed with the error below :

[datacenter@localhost log]$ su - root
Password:: No such file or directory

same error occurs if try to su as user x.

[datacenter@localhost log]$ su - x
: No such file or directory

Not even able to ssh as the user root.


This issue happen because customer edited the /etc/passwd from a Window environment.
Noticed /etc/passwd file had DOS line endings.

For example when we use vi editor to open /etc/passwd file following were noticed :

vi /etc/passwd

The ^M should not be there and is likely introduced by editing on a Windows platform (although there could be other explanations).

In order to fix the issue remove ^M at the end of each line in /etc/passwd file.

Root Cause

Attempting to edit Red Hat configuration lines from Windows add ^M at end of line.
Windows line ending charactors are different to linux line ending charactors.

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.