From 703c7a3943ca51eac046a61b6a745aba7dc93527 Mon Sep 17 00:00:00 2001 From: Anthony Date: Sat, 28 Oct 2023 00:19:22 +0800 Subject: [PATCH] separated the install requirements --- add-sftp.sh | 8 ++++++-- install-sftp.sh | 15 +++++++++++++++ 2 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 install-sftp.sh diff --git a/add-sftp.sh b/add-sftp.sh index 4bb6be0..0c0c895 100644 --- a/add-sftp.sh +++ b/add-sftp.sh @@ -20,8 +20,12 @@ if [ $? -ne 0 ]; then fi echo "$USERNAME:$PASSWORD" | chpasswd -# Set user's group to litespeed (or another group with SFTP permissions) -usermod -aG litespeed $USERNAME +# Set user's group to both litespeed and root +usermod -aG litespeed,root $USERNAME + +# Adjust permissions for the user to write to the ROOT_DIRECTORY +chown $USERNAME:root $ROOT_DIRECTORY +chmod 775 $ROOT_DIRECTORY # Get the hostname HOSTNAME=$(hostname -f) diff --git a/install-sftp.sh b/install-sftp.sh new file mode 100644 index 0000000..25b1c73 --- /dev/null +++ b/install-sftp.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +# Become root +sudo su + +# Download the SFTP user creation script +curl -O https://deploy-proxy.mightybox.io/addons/add-sftp-user/raw/branch/main/add-sftp.sh +chmod +x add-sftp.sh + +# Update sshd_config +echo -e "\nMatch User user*\nPasswordAuthentication yes" >> /etc/ssh/sshd_config + +# Adjust permissions +chown root:root /var/www/webroot/ROOT +chmod 755 /var/www/webroot/ROOT