Fixed PasswordAuthentication

pull/1/head
Anthony 2025-02-27 00:38:19 +08:00
parent be6ce918b2
commit 6372c8dc9b
1 changed files with 9 additions and 3 deletions

View File

@ -76,8 +76,14 @@ onInstall:
chmod +x /home/jelastic/add-sftp-user-addon/*.sh chmod +x /home/jelastic/add-sftp-user-addon/*.sh
- cmd[cp]: - cmd[cp]:
user: root user: root
commands: commands: |-
- echo -e "\nMatch User user*\nPasswordAuthentication yes" >> /etc/ssh/sshd_config if grep -qE "^Match User user[0-9]*$" /etc/ssh/sshd_config; then
sed -i '/^Match User user[0-9]*/!b;n;c\ PasswordAuthentication yes' /etc/ssh/sshd_config
else
echo -e "\n# Added by SFTP addon\nMatch User user*\n\tPasswordAuthentication yes" >> /etc/ssh/sshd_config
fi
awk '!seen[$0]++' /etc/ssh/sshd_config > /etc/ssh/sshd_config.tmp && mv /etc/ssh/sshd_config.tmp /etc/ssh/sshd_config
systemctl restart sshd
- cmd[cp]: - cmd[cp]:
user: root user: root
commands: commands: