Skip to content

Commit

Permalink
sftp
Browse files Browse the repository at this point in the history
Improved and cleaned SFTP function. Wrong sftp-server assigned was fixed.
  • Loading branch information
QROkes committed Sep 26, 2024
1 parent 171c703 commit 3c3f725
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions lib/webin
Original file line number Diff line number Diff line change
Expand Up @@ -794,11 +794,10 @@ www_data_sftp_access() {
sudo chown -R www-data:www-data /var/www

# www-data sftp-only access jail - if fails usrlib must be listed in /etc/shells
sudo usermod -s /usr/lib/openssh/sftp-server www-data
sudo addgroup --system sftponly > /dev/null 2>&1
sudo usermod -G sftponly www-data
sudo chown root:root /var/www
sudo sed -i "/Subsystem sftp/c\Subsystem sftp internal-sftp" /etc/ssh/sshd_config
sudo sed -i "/Subsystem sftp/c\Subsystem sftp internal-sftp" /etc/ssh/sshd_config
sudo echo '# WebinolySFTPstart
Match Group sftponly
ChrootDirectory /var/www
Expand All @@ -816,11 +815,10 @@ Match Group sftponly
echo "${gre}SFTP access for www-data user has been successfuly enabled! ${end}"

elif [[ $login_www_data == "off" ]]; then
sudo sed -i '/www-data:/c\www-data:x:33:33:www-data:\/var\/www:\/usr\/sbin\/nologin' /etc/passwd
sudo gpasswd -d www-data sftponly > /dev/null 2>&1
sudo delgroup sftponly > /dev/null 2>&1
sudo chown www-data:www-data /var/www
sudo sed -i "/Subsystem sftp/c\Subsystem sftp \/usr\/lib\/openssh\/sftp-server" /etc/ssh/sshd_config
sudo sed -i "/Subsystem sftp/c\Subsystem sftp \/usr\/lib\/openssh\/sftp-server" /etc/ssh/sshd_config # This is the default value!
sudo sed -i '/WebinolySFTPstart/,/WebinolySFTPend/{/.*/d}' /etc/ssh/sshd_config

falus=$( grep -Gi "^AllowUsers " /etc/ssh/sshd_config )
Expand Down

0 comments on commit 3c3f725

Please sign in to comment.