Author Topic: DirectAdmin ให้ uninstall pureftp และทำการ enable proftpd พร้อมกับ sFTP  (Read 2047 times)

golfreeze

  • Administrator
  • Hero Member
  • *****
  • Posts: 2140
    • View Profile
    • นั่งสมาธิ สติปัฏฐานสี่ พาเที่ยววัด แนะนำวัด แจกcd ธรรมะฟรี
    • Email
วันนี้มีโจทย์ให้ทำ บน DirectAdmin ให้ uninstall pureftp และทำการ enable proftpd พร้อมกับ sFTP feature ขึ้นมา

==เริ่มด้วย stop pureftp first เพราะ default ลงมาเป็น pureftp
cd /usr/local/directadmin/custombuild
./build set pureftpd_uploadscan no

ทำการ build proftpd
# cd /usr/local/directadmin/custombuild
# ./build update
# ./build set ftpd proftpd
# mkdir -p custom/proftpd/conf (make a directory for custom ProFTPd config that adds mod_sftp)
# wget -O custom/proftpd/configure.proftpd http://files.directadmin.com/services/all/sftp/configure.proftpd.sftp
# wget -O custom/proftpd/conf/proftpd.conf http://files.directadmin.com/services/all/sftp/proftpd.conf
# chmod 755 custom/proftpd/configure.proftpd
# wget -O /etc/proftpd.sftp.conf http://files.directadmin.com/services/all/sftp/proftpd.sftp.conf
# mkdir /etc/proftpd.ssl
# cp /etc/ssh/ssh_host_rsa_key* /etc/proftpd.ssl
# chmod 400 /etc/proftpd.ssl/ssh_host_rsa_key
# cp /etc/proftpd.sftp.conf /etc/proftpd.sftp.conf_original

===Edit /etc/proftpd.sftp.conf ตรงส่วน SFTPHostKey ให้ไปชี้ /etc/proftpd.ssl/ssh_host_rsa_key แทน !!!! ไม่งั้นจะทำงาน sftp ไม่ได้ ===
<IfModule mod_sftp.c>
<VirtualHost 0.0.0.0>
# The SFTP configuration
# Port 23
Port 22 # Change to standard port now possible after moving SSH to 44
AuthUserFile /etc/proftpd.passwd
TransferLog /var/log/proftpd/xferlog.legacy
ExtendedLog /var/log/proftpd/75.126.244.2.bytes WRITE,READ userlog
SFTPEngine on
SFTPLog /var/log/proftpd/sftp.log
# SFTPHostKey /etc/ssh/ssh_host_rsa_key
SFTPHostKey /etc/proftpd.ssl/ssh_host_rsa_key # Change to use key pair copied to /etc/proftpd.ssl and given necessary rights (0400) for mod_sftp.c work.
SFTPAuthorizedUserKeys file:~/.sftp/authorized_keys

หลังจากนั้นทำการ rebuild อีกรอบ
# cd /usr/local/directadmin/custombuild
# ./build proftpd
service proftpd restart

แล้วเทสกับ Filezilla ก็จะใช้งาน sFTP ได้ครับผม  :)

===recompile proftpd
https://forum.directadmin.com/threads/how-to-set-up-your-proftpd-ftp-server-to-support-the-secure-protocols-while-disabling-insecure-ftp.65025/
https://forum.directadmin.com/threads/proftpd-issue-with-sftp.63352/
https://docs.directadmin.com/other-hosting-services/ftp/general.html

golfreeze

  • Administrator
  • Hero Member
  • *****
  • Posts: 2140
    • View Profile
    • นั่งสมาธิ สติปัฏฐานสี่ พาเที่ยววัด แนะนำวัด แจกcd ธรรมะฟรี
    • Email
==== ถ้าดูจาก message log แล้ว start proftpd ไม่ขึ้น
mod_sftp/1.1.1: Server 'ProFTPd': cannot support both FTPS (TLSEngine on) and SFTP (SFTPEngine on) for the same host
ทำการแก้ไขโดย
perl -pi -e 's/TLSEngine.*/TLSEngine off/' /etc/proftpd.conf

#systemctl restart proftpd