Only root login remains (all other users gone) and even root hangs, so can't access! We have been locked out of our iMac running on El Capitan. Basically all known user accounts have disappeared. Only "other" remains which seems to the "system administrator" or "root" and when trying to login with this one, it hangs (endless turning white circle). Have been on forums and tried many of the First Aid (and second aid) tips and tricks, including fsck (where I found out initially "MacHD had been modified", and eventually got to "MacHD seems to be working fine").

Someone suggested the problem may be in Launch Services area and to access the Mac through FireWire and Target Disk Mode, but I don't have the possibility for such connection, plus without step-by-step I am not tech savvy enough to dare the programming challenge it seemed to require.

Any help would be wonderful. I would bring it in, but as always when things fail, several important docs on the hard drive hadn't been backed up yet, so there we are.
According to several sources: Apple discussions or Mac notebooks: Apple Hardware Test may report "HDD" alert the error: error 4HDD/11/40000000:SATA(0,0) may be erroneous or at least unclear/dubious.

It may be related to the vanishing of your users in the Login Screen or not.



Depending on your findings in Single User Mode you have several options:


Removing .AppleSetupDone to re-run Setup Assistant

To remove this file, you have to boot to single user mode by pressing ⌘S while booting. After a few moments, you'll see the Mac boot to the command line.

Check the file system and mount your main volume in read/write mode

/sbin/fsck -fy
/sbin/mount -uw /


With the filesystem mounted and accessible, it's time to remove the file so OS X will re-run Setup Assistant:

rm /var/db/.AppleSetupDone


Reboot your Mac with

reboot


After rebooting the Setup Assistant will create a new user and setup your system. Choose a user name not used previously. Search for any "old" (in /Users) or moved (elsewhere) previous user folders. In a second step you can change the permissions of the individual user folders and recover all data.

This might fail if your system is corrupted (bogus LaunchServices etc.)
If your system seems to be corrupted, reinstall it:

Reboot to Recovery Mode by pressing ⌘R while booting.

Open Disk Utility in the main panel and verify/repair your main volume and permissions. Quit Disk Utility.

Reinstall the system with Reinstall OS X. This shouldn't affect any user data or already installed apps.
If the previous step also fails I recommend to slightly resize the main volume, create a new 50 GB volume and install a fresh version of OS X to it. Since you have a Fusion Drive (CoreStorage LVG) you may either use the command line or Disk Utility to resize the main volume. Using Disk Utility choose the Fusion Drive and "Partition" and use the handler to slightly resize the main drive. Then choose the new item "Untitled" and the erase button and rename it to something else but stay with the default format (OS X Extended (Journaled)).

After successfully installing OS X to the new small volume attach an external drive and save all precious data to it. You may have to adjust the permissions of some of the user folders to accomplish this.

Finally erase the drive and install a new system. Now either let it check by an Apple authorized technician or at the Apple Genius bar for the errors mentioned at the beginning or continue setting up your system.