Cannot su in to user accounts. Error "No such file or directory"
Environment
- Red Hat Enterprise Linux (All versions)
- su
Issue
-
suasrootuser 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
suas userx.[datacenter@localhost log]$ su - x Password: : No such file or directory -
Not even able to
sshas the userroot.
Resolution
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
root:x:0:0:root:/root:/bin/bash^M
The ^M should not be there and is likely introduced by editing on a Windows platform (although there could be other explanations).
dos2unixremove^Mat the end of each line in/etc/passwdfile:
# dos2unix /etc/passwd
Root Cause
Attempting to edit Red Hat configuration lines from Windows add ^M at end of line.
Windows line ending characters are different to linux line ending characters.
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.
Comments