Educational ICT Virtualisation Specialist

Twitter LinkedIn E-mail
Precedence Technologies Ltd
Technology House, 36a Union Lane
Cambridge, CB4 1QB, United Kingdom
T: +44 (0)8456 446 800 / +44 (0)1223 359900
E: enquiries@precedence.co.uk
PwdRecover

Jump To: Support > KB > NetManager > PwdRecover

Recovering a corrupt password database

If you see errors on the console such as the following or you cannot log in even as root on the console, then perhaps the password database is corrupted:

netmanager sshd[7948] fatal privilege separation user sshd does not exist
netmanager atrun[3536] cannot get uid for 'nobody' 

This can happen if the power is switched off immediately after the password database was modified.

To fix we can use the nightly backups:

  1. Press the power button, this should turn the machine off cleanly. If it does not, hold the power button until it goes off
  2. Power the server back on and wait for the Boot Menu
  3. At the Boot Menu, pick option 5 Single User
  4. At Enter pathname of shell or RETURN for /bin/sh: press Return
  5. If you get prompted Terminal type? [unknown], enter vt100 and press Return
  6. You should now be at a # prompt
  7. Run the following to check the file systems: fsck -y
  8. Run the following to mount the file systems in writeable mode: mount -a
  9. Find the latest snapshot by date by running: ls /var/snapshot
    # ls /var/snapshot
    01032018-0000.cnf   04032018-0000.cnf   07032018-0000.cnf   27022018-0000.cnf
    01032018-0000.tgz   04032018-0000.tgz   07032018-0000.tgz   27022018-0000.tgz
    02032018-0000.cnf   05032018-0000.cnf   08032018-0000.cnf   28022018-0000.cnf
    02032018-0000.tgz   05032018-0000.tgz   08032018-0000.tgz   28022018-0000.tgz
    03032018-0000.cnf   06032018-0000.cnf   26022018-0000.cnf
    03032018-0000.tgz   06032018-0000.tgz   26022018-0000.tgz
    
  10. Take a note of the file with the latest date (and the one before it, just in case). In this case it is 08032018-0000.tgz which backed up at midnight on 8th March 2018
  11. Run the following to change to the configuration directory: cd /etc
  12. Extract the group and user files with the following (replace the filename as above):
    tar -xzf /var/snapshot/08032018-0000.tgz master.passwd group
    
  13. Clean up and regenerate the password database with the following commands:
    cp master.passwd ptmp
    rm -f pwd.db* spwd.db*
    pwd_mkdb -p ptmp
    
  14. Check standard users exist by using id followed by the user name. Examples:
    # id root
    uid=0(root) gid=0(wheel) groups=0(wheel),2(kmem),3(sys),4(tty),5(operator)
    # id ncadmin
    uid=52(ncadmin) gid=0(wheel) groups=0(wheel)
    # id nobody
    uid=32767(nobody) gid=9999 groups=9999
    
  15. You may also reset passwords from here by using the passwd command:
    # passwd root
    Changing password for root.
    New Password:
    Retype New Password:
    
  16. When finished type reboot
© Copyright Precedence Technologies 1999-2024
Page last modified on April 06, 2018, at 05:16 PM by sborrill