Labels

hpunix (63) marathi kavita (52) linux (21) solaris11 (10) AWS (5) numerology (5)

Tuesday, January 27, 2015

Root password forgot + HPUX

Root password forgot + HPUX

Situation: I was not able to do sudo as somebody changed the permission on sudoers file or sudoers file is corruped so I had to login with root user through console, but i 
got to know that i dont know root password.

While doing sudo i got below error:

mysrv:/home/> sudo su -
sudo: /opt/iexpress/sudo/etc/sudoers is mode 0440, should be 0644


Solution : Reboot the server in single user mode through console and edit the file /tcb/files/auth/r/root.

Steps:

1. Reboot the server through console either by PC or RS command:

2. interrupt the boot sequence to interact with ISL (initial system loader)

************************************
Processor is booting from first available device.

To discontinue, press any key within 10 seconds.

Boot terminated.


---- Main Menu ---------------------------------------------------------------

     Command                           Description
     -------                           -----------
     BOot [PRI|ALT|]             Boot from specified path
     PAth [PRI|ALT] []           Display or modify a path
     SEArch [DIsplay|IPL] []     Search for boot devices

     COnfiguration menu                Displays or sets boot values
     INformation menu                  Displays hardware information
     SERvice menu                      Displays service commands

     DIsplay                           Redisplay the current menu
     HElp [|]           Display help for menu or command
     RESET                             Restart the system
----
Main Menu: Enter command or menu > bo pri ISL
Interact with IPL (Y, N, or Cancel)?> Y

Booting...
Boot IO Dependent Code (IODC) revision 1


HARD Booted.

ISL Revision A.00.43  Apr 12, 2000

ISL>


3. Go to single user mode

*******************************************************

ISL> hpux -is

Boot
: disk(0/0/1/1.2.0.0.0.0.0;0)/stand/vmunix
10649600 + 2105344 + 2044264 start 0x1fe4e8

alloc_pdc_pages: Relocating PDC from 0xf0f0000000 to 0x7fa01000.
gate64: sysvec_vaddr = 0xc0002000 for 2 pages
NOTICE: autofs_link(): File system was registered at index 3.
NOTICE: cachefs_link(): File system was registered at index 5.
NOTICE: nfs3_link(): File system was registered at index 6.
td: claimed Tachyon XL2 Fibre Channel Mass Storage card at 0/2/0/0
td: claimed Tachyon XL2 Fibre Channel Mass Storage card at 0/3/0/0
td: claimed Tachyon XL2 Fibre Channel Mass Storage card at 0/6/0/0
td: claimed Tachyon XL2 Fibre Channel Mass Storage card at 0/7/0/0

    System Console is on the Built-In Serial Interface
Logical volume 64, 0x3 configured as ROOT
Logical volume 64, 0x2 configured as SWAP
Logical volume 64, 0x2 configured as DUMP
    Swap device table:  (start & size given in 512-byte blocks)
        entry 0 - major is 64, minor is 0x2; start = 0, size = 8388608
Starting the STREAMS daemons-phase 1
Checking root file system.
log replay in progress
replay complete - marking super-block as CLEAN
Root check done.
Create STCP device files
Starting the STREAMS daemons-phase 2
              $Revision: vmunix:    vw: -proj    selectors: CUPI80_BL2000_1108 -c 'Vw for CUPI80_BL2000_1108 build' -- cupi80_bl2000_1108 'CUPI80_BL2000_1108'  Wed Nov  8 
19:24:56 PST 2000 $
Memory Information:
    physical page size = 4096 bytes, logical page size = 4096 bytes
    Physical: 4194304 Kbytes, lockable: 3158620 Kbytes, available: 3639268 Kbytes

/sbin/ioinitrc:
/dev/vg00/lvol1: 67 files, 0 icont, 5132 used, 57066 free (162 frags, 7113 blocks)
/sbin/krs_sysinit:


Starting EMC PowerPath.


INIT: Overriding default level with level 's'

INIT: SINGLE USER MODE

INIT: Running /sbin/sh

****************************************************************

4. Run mountall command or just mount /var , /tmp, /usr by looking into /etc/fstab file.

# cat /etc/fstab

#mountall

Note: while mounting FS if any error comes then run fsck command on that LVs/FS.


5. Try to change root password. but we can't as we dont know old root password.

# passwd root
Old password:

6. So edit the trusted system file means /tcb/files/auth/r/root and nullify the u_pwd string which stores password in it.

# cat /tcb/files/auth/r/root |grep -i "u_pwd"
        :u_pwd=mGsOWDUjI0ULw4bkUQL6uxQY:\

7. After making null password or blank password

# cat /tcb/files/auth/r/root |grep -i "u_pwd"
        :u_pwd=:\

8. Now change the password for root, this time it will not ask old root password to type.

# passwd root

9. unmount all the mouted filesystems.

# umountall

10. Reboot the system 

# reboot
Shutdown at 14:45 (in 0 minutes)
System shutdown time has arrived


Thanks...
Kiran Jadhav


**Let's Share our knowledge and keep visiting here**

No comments:

Post a Comment