Showing results for 
Search instead for 
Did you mean: 

unable to login as root


unable to login as root

Hi all,
I am facing login issue with root. I am unable to sudo or su -

Please find the below output after entering the different command.

In addition, root password is not accepting after su -

Please help me to resolve the issue.

$ /usr/local/bin/sudo su -
sudo: unknown uid: 20034
$ id
uid=20034() gid=6001(unxinfra)
$ id root
uid=0() gid=3(sys) groups=6001(unxinfra)
$ grep 20034 /etc/passwd
$ grep root /etc/passwd
root:1bd1RlC9JFld6:0:3:866/F/*AZUX01/IBM/root Super-User,,,:/:/sbin/sh
$ ll /etc/passwd
-r--r--r-- 1 0 sys 15544 May 24 10:36 /etc/passwd
$ uname -a
HP-UX zcux06 B.11.00 A 9000/800 1520716597 two-user license

Thanks in advance,
Trusted Contributor

Re: unable to login as root

Check your /etc/nsswitch.conf file, and make sure that the passwd line lists "files" as the first source.

The call in question here is "getpwnam()" and it's evidently running into trouble somewhere.

Try using Perl to access the /etc/passwd:

perl -e 'print join(":", getpwuid(0))'

It'll probably give the same results as su, but it'd be an interesting experiment in any case.

Maybe there's some sort of formatting problem in the /etc/passwd that's tripping things up. Your gcos field looks too clever by half.
Honored Contributor

Re: unable to login as root

There is definitely something funny about accessing the /etc/passwd file. In the UID portion of the 'id' command output above, no user name is shown. It should say 'uid=0(root)' and 'uid=20034(kzkt963)'.

The suggestion above about checking nsswitch.conf is good.

I would also run 'pwck' to check the /etc/passwd file to make sure there is nothing wrong with it.