I realize this question (or similar ones) have been asked elsewhere, but the solutions haven’t worked for me. I’m trying to use ammonite in a scala/java project locally and start the SSH server with
import ammonite.sshd._
import org.apache.sshd.server.auth.password.{AcceptAllPasswordAuthenticator, StaticPasswordAuthenticator}
val replServer = new SshdRepl(
SshServerConfig(
address = "localhost", // or "0.0.0.0" for public-facing shells
port = 22222, // Any available port
passwordAuthenticator = Some(AcceptAllPasswordAuthenticator.INSTANCE)
)
)
replServer.start()
I am then able to connect and authenticate with ssh jbennett@localhost -p22222
(or any username, it doesn’t seem to matter, but I’ve read elsewhere using a user without a home folder can cause problems, so I use an existing username). Problem is after authenticating the connection immediately closes. Here’s the output of ssh jbennett@localhost -p22222 -vvvv
: https://pastebin.com/DAZyxnBH
I’ve looked at /etc/ssh/sshd_config
and everything is mostly defaults. I tried changing to use internal-sftp
following one other suggestion, but that didn’t make a difference.
#old line:
#Subsystem sftp /usr/libexec/sftp-server
#new line:
Subsystem sftp internal-sftp
The full file is here: https://pastebin.com/0FcivDVf and the include line’s file contents is just
# Options set by macOS that differ from the OpenSSH defaults.
UsePAM yes
AcceptEnv LANG LC_*
Subsystem sftp /usr/libexec/sftp-server
Not sure if this matters for this use case, since the SSH connection is connecting to a REPL instead of a shell, but my login shell starts up fine for the jbennett
user, so it doesn’t appear to be a problem with the shell profile, either.
Please let me know if you have any ideas on how to fix this!