[Moto G Q&A, Help & Troubleshooting] Leproide:
Hi,

sshd won't work on my Moto G (Falcon) with CM13 :(

Can anyone help me?

Logcat:

07-17 00:42:25.618 24464 24464 I /system/bin/sshd: Server listening on :: port 22.
07-17 00:42:25.618 24464 24464 I /system/bin/sshd: Server listening on 0.0.0.0 port 22.
07-17 00:42:28.787 24492 24492 E /system/bin/sshd: error: Could not load host key: /data/ssh/ssh_host_dsa_key
07-17 00:42:28.792 24492 24492 I /system/bin/sshd: WARNING: /data/ssh/moduli does not exist, using fixed modulus
07-17 00:42:28.901 218 218 F DEBUG : pid: 24493, tid: 24493, name: sshd >>> /system/bin/sshd: [net] <<<
07-17 00:42:28.938 218 218 F DEBUG : #10 pc 0000cdc9 /system/bin/sshd
07-17 00:42:28.938 218 218 F DEBUG : #13 pc 00020d6f /system/bin/sshd
07-17 00:42:28.938 218 218 F DEBUG : #15 pc 000073e4 /system/bin/sshd
07-17 00:42:28.989 24492 24492 E /system/bin/sshd: error: mm_request_receive: socket closed

/data/ssh:

drw------- 2 root shell 4096 1970-01-01 05:49 empty
-rw------- 1 root root 672 2016-07-17 01:01 ssh_host_dsa_key
-rw-r--r-- 1 root root 604 2016-07-17 01:01 ssh_host_dsa_key.pub
-rw------- 1 root root 1675 2016-07-17 01:01 ssh_host_rsa_key
-rw-r--r-- 1 root root 396 2016-07-17 01:01 ssh_host_rsa_key.pub
-rw------- 1 root root 5 2016-07-17 01:11 sshd.pid
-rw------- 1 root root 3330 2016-07-17 00:00 sshd_config

sshd_config:

#	$OpenBSD: sshd_config,v 1.84 2011/05/23 03:30:07 djm Exp $

# This is the sshd server system-wide configuration file. See
# sshd_config(5) for more information.

# This sshd was compiled with PATH=/usr/bin:/bin:/usr/sbin:/sbin

# The strategy used for options in the default sshd_config shipped with
# OpenSSH is to specify options with their default value where
# possible, but leave them commented. Uncommented options override the
# default value.

#Port 22
#AddressFamily any
#ListenAddress 0.0.0.0
#ListenAddress ::

# The default requires explicit activation of protocol 1
Protocol 2

# HostKey for protocol version 1
#HostKey /etc/ssh/ssh_host_key
# HostKeys for protocol version 2
HostKey /data/ssh/ssh_host_rsa_key
HostKey /data/ssh/ssh_host_dsa_key

# Lifetime and size of ephemeral version 1 server key
#KeyRegenerationInterval 1h
#ServerKeyBits 1024

# Logging
# obsoletes QuietMode and FascistLogging
#SyslogFacility AUTH
#LogLevel INFO

# Authentication:

#LoginGraceTime 2m
PermitRootLogin no
#StrictModes yes
#MaxAuthTries 6
#MaxSessions 10

#RSAAuthentication yes
PubkeyAuthentication yes

# The default is to check both .ssh/authorized_keys and .ssh/authorized_keys2
# but this is overridden so installations will only check .ssh/authorized_keys
AuthorizedKeysFile	/data/ssh/authorized_keys

# For this to work you will also need host keys in /etc/ssh/ssh_known_hosts
#RhostsRSAAuthentication no
# similar for protocol version 2
#HostbasedAuthentication no
# Change to yes if you don't trust ~/.ssh/known_hosts for
# RhostsRSAAuthentication and HostbasedAuthentication
#IgnoreUserKnownHosts no
# Don't read the user's ~/.rhosts and ~/.shosts files
#IgnoreRhosts yes

# To disable tunneled clear text passwords, change to no here!
PasswordAuthentication no
PermitEmptyPasswords no

# Change to no to disable s/key passwords
ChallengeResponseAuthentication no

# Kerberos options
#KerberosAuthentication no
#KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes
#KerberosGetAFSToken no

# GSSAPI options
#GSSAPIAuthentication no
#GSSAPICleanupCredentials yes

# Set this to 'yes' to enable PAM authentication, account processing,
# and session processing. If this is enabled, PAM authentication will
# be allowed through the ChallengeResponseAuthentication and
# PasswordAuthentication. Depending on your PAM configuration,
# PAM authentication via ChallengeResponseAuthentication may bypass
# the setting of "PermitRootLogin without-password".
# If you just want the PAM account and session checks to run without
# PAM authentication, then enable this but set PasswordAuthentication
# and ChallengeResponseAuthentication to 'no'.
#UsePAM no

#AllowAgentForwarding yes
#AllowTcpForwarding yes
#GatewayPorts no
#X11Forwarding no
#X11DisplayOffset 10
#X11UseLocalhost yes
#PrintMotd yes
#PrintLastLog yes
#TCPKeepAlive yes
#UseLogin no
#UsePrivilegeSeparation yes
#PermitUserEnvironment no
#Compression delayed
#ClientAliveInterval 0
#ClientAliveCountMax 3
#UseDNS yes
PidFile /data/ssh/sshd.pid
#MaxStartups 10
#PermitTunnel no
#ChrootDirectory none

# no default banner path
Banner /data/ssh/banner

# override default of no subsystems
Subsystem	sftp	internal-sftp

# Example of overriding settings on a per-user basis
#Match User anoncvs
#	X11Forwarding no
#	AllowTcpForwarding no
#	ForceCommand cvs server

/data/local/userinit.d/99sshd:

#!/system/bin/sh

umask 077

# DEBUG=1

DSA_KEY=/data/ssh/ssh_host_dsa_key
DSA_PUB_KEY=/data/ssh/ssh_host_dsa_key.pub
RSA_KEY=/data/ssh/ssh_host_rsa_key
RSA_PUB_KEY=/data/ssh/ssh_host_rsa_key.pub
AUTHORIZED_KEYS=/data/ssh/authorized_keys
DEFAULT_AUTHORIZED_KEYS=/system/etc/security/authorized_keys.default

if [ ! -f $DSA_KEY ]; then
/system/bin/ssh-keygen -t dsa -f $DSA_KEY -N ""
chmod 600 /$DSA_KEY
chmod 644 $DSA_PUB_KEY
fi

if [ ! -f $RSA_KEY ]; then
/system/bin/ssh-keygen -t rsa -f $RSA_KEY -N ""
chmod 600 /$RSA_KEY
chmod 644 $RSA_PUB_KEY
fi

if [[ ! -f $AUTHORIZED_KEYS && -f $DEFAULT_AUTHORIZED_KEYS ]]; then
cat $DEFAULT_AUTHORIZED_KEYS > $AUTHORIZED_KEYS
fi

if [ "1" == "$DEBUG" ] ; then
# run sshd in debug mode and capture output to logcat
/system/bin/logwrapper /system/bin/sshd -f /data/ssh/sshd_config -D -d
else
# don't daemonize - otherwise we can't stop the sshd service
/system/bin/sshd -f /data/ssh/sshd_config -D
fi

Thanks in advance

Post on cyanogenmod forum:

https://forum.cyanogenmod.org/topic/127039-sshd-problem-cm13/#comment-603490