Carlos Aguni

Highly motivated self-taught IT analyst. Always learning and ready to explore new skills. An eternal apprentice.


SSHD Non Root

02 Oct 2022 »
rootdir="~/wkdir"
ssh-keygen -q -N "" -t dsa -f ${rootdir}/ssh_host_dsa_key
ssh-keygen -q -N "" -t rsa -f ${rootdir}/ssh_host_rsa_key
ssh-keygen -q -N "" -t ecdsa -f ${rootdir}/ssh_host_ecdsa_key
ssh-keygen -q -N "" -t ed25519 -f ${rootdir}/ssh_host_ed25519_key

cp /etc/ssh/sshd_config ${rootdir}/

cat > ${rootdir}/sshd_config <<EOF
Port 2022
HostKey ${rootdir}/ssh_host_rsa_key
HostKey ${rootdir}/ssh_host_ecdsa_key
HostKey ${rootdir}/ssh_host_ed25519_key

LogLevel DEBUG3
ChallengeResponseAuthentication no
UsePAM yes
X11Forwarding yes
PrintMotd no
PidFile ${rootdir}/sshd.pid
AcceptEnv LANG LC_*
Subsystem sftp /usr/lib/openssh/sftp-server
EOF

/usr/bin/sshd -D -f ${rootdir}/sshd_config