cancel
Showing results for 
Search instead for 
Did you mean: 

unable to login as root

 
Highlighted
Advisor

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
kzkt963:vuisokBEbdbb.,A.dV:20034:6001:744/I/075091//thota.venkat.g.INC000000711214:/home/kzkt963:/bin/ksh
$
$ 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,
Santhosh
santhosh
2 REPLIES 2
Highlighted
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.
Highlighted
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.