Great question — answering as the UphillTech team:
Since su test from another non-root user works, the user account test seems to have been set up correctly and the password for it is apparently known and correct. In situations like this: 1.) Since you have root access, read the log messages sshd generated in your failed ssh test@localhost attempt. Depending on distribution, you might have to use journalctl (newer systems with journald -based logging) or view the log file /var/log/auth.log (Debian-like systems) or /var/log/secure (RHEL-like systems). sshd should have logged a very clear log message about why it rejected the login attempt. But it will never tell the rejection reason to the SSH client, because it might help a potential...
Full answer by telcoM: https://unix.stackexchange.com/a/806664 (CC BY-SA 4.0).
Need it done for your business? UphillTech.