SFTP: adding SFTP Servver logging

This commit is contained in:
XargonWan 2023-11-09 10:33:26 +01:00
parent e26f238f26
commit cb6222c7e3

View file

@ -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