I'm running macOS 10.14.6 on an iMac named angharad. It's generally working fine.
I have created a new user account named alice to use for testing an SSH client. I can log in as alice using the Mac desktop interface, and I can su - alice no problem. But I cannot ssh in to localhost as this user. When I do so, I just get a "Connection closed" message.
[~] $ ssh alice@localhost Password: Connection closed by ::1 port 22 [~] $ I am definitely entering the password correctly.
I can ssh localhost or ssh janke@localhost using my main janke account just fine.
When I look at /var/log/system.log, I see one of these appear each time I try to make a connection:
Apr 19 22:48:28 angharad login[29662]: USER_PROCESS: 29662 ttys002 Apr 19 22:48:35 angharad com.apple.xpc.launchd[1] (com.openssh.sshd.E37AD3EB-1E30-4F30-B96A-FBE9B2240D7F[29710]): Service exited with abnormal code: 255 (and then a bunch of spam from Electron apps and the Microsoft Remote Desktop client.)
Then I looked in Console and found this:
23:10:34.899109 sshd error: PAM: user account has expired for alice from ::1 23:1034:908664 sshd fatal: monitor_read: unpermitted request 104 Any ideas what might be going on here?
51 Answer
The log message says that the "alice" user account is expired. But that makes no sense, since the user can log in successfully in other contexts. I did a little research and found this:
TL;DR: go into System Preferences, Sharing, then click on "Remote Login" and adjust the access list to include the new user. Presumably for safety's sake, ssh logins need to be set up in this access list. It works for you because administrative accounts are allowed by default.
1