~/.ssh/authorized_keys and add your public key contents~/.ssh/id_rsa) and paste the private key contents/etc/ssh/sshd_config (with sudo) so the following lines match:PubkeyAuthentication yes
PasswordAuthentication no
Then restart ssh with sudo systemctl restart sshd.service or sudo service sshd restart
This guide has been altered from Trixzyy's guide on Github
/sbin/sshd-login and make it executable:sudo touch /sbin/sshd-login && sudo chmod +x /sbin/sshd-login
sudo <EDITOR> /sbin/sshd-login and entering the following:#!/bin/bash
WEBHOOK_URL="[Webhook URL]"
DISCORDUSER="<@[Discord UserID]>"
# Capture only open and close sessions.
case "$PAM_TYPE" in
open_session)
PAYLOAD=" { \"content\": \"$DISCORDUSER: User \`$PAM_USER\` logged in to \`$HOSTNAME\` (remote host: $PAM_RHOST).\" }"
;;
close_session)
PAYLOAD=" { \"content\": \"$DISCORDUSER: User \`$PAM_USER\` logged out of \`$HOSTNAME\` (remote host: $PAM_RHOST).\" }"
;;
esac
# If payload exists fire webhook
if [ -n "$PAYLOAD" ] ; then
curl -X POST -H 'Content-Type: application/json' -d "$PAYLOAD" "$WEBHOOK_URL"
fi
/etc/pam.d/sshd:sudo echo "session optional pam_exec.so /sbin/sshd-login" >> /etc/pam.d/ssh.d
sudo service sshd restartsudo systemctl restart sshd.service if the first command doesn't work.