From cb6222c7e35052d5df8e90576775e63c54b76531 Mon Sep 17 00:00:00 2001 From: XargonWan Date: Thu, 9 Nov 2023 10:33:26 +0100 Subject: [PATCH] SFTP: adding SFTP Servver logging --- functions/sftp_server.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/functions/sftp_server.sh b/functions/sftp_server.sh index 9abbe1eb..f50a5b67 100644 --- a/functions/sftp_server.sh +++ b/functions/sftp_server.sh @@ -3,6 +3,9 @@ port=22 ip=$(hostname -I | awk '{print $1}') +# Set the log file path +log_file="$rdhome/.logs/sftp_server.log" + # Check if the port is in use if nc -z localhost $port; then zenity --error --no-wrap \ @@ -19,6 +22,9 @@ echo "retrodeck:$(openssl passwd -1 retrodeck)" >> /tmp/sftp_home/retrodeck/etc/ # Set rdhome as the home directory for retrodeck user echo "Match User retrodeck\n ChrootDirectory $rdhome" >> /etc/ssh/sshd_config +# Redirect SSHD logs to the specified log file +echo "Match User retrodeck\n ChrootDirectory $rdhome\n ForceCommand internal-sftp -l INFO -f $log_file" >> /etc/ssh/sshd_config + # Restart SSHD to apply the new configuration service ssh restart