Debian SFTP加密方式配置指南
一 概念澄清
二 配置 SFTP 的加密与算法
sudo apt update && sudo apt install openssh-server/etc/ssh/sshd_config:
Subsystem sftp internal-sftpCiphers aes256-ctr,aes192-ctr,aes128-ctrMACs hmac-sha2-256,hmac-sha2-512KexAlgorithms curve25519-sha256,ecdh-sha2-nistp521,ecdh-sha2-nistp384,ecdh-sha2-nistp256,diffie-hellman-group-exchange-sha256Match Group sftpusersChrootDirectory %hForceCommand internal-sftpAllowTcpForwarding noX11Forwarding nosudo systemctl restart sshsftp -o Port=22 username@your_server_ipssh -vvv username@your_server_ipaes128-cbc、3des-cbc、hmac-md5 等)。三 使用密钥认证提升安全性
ssh-keygen -t ed25519 -b 4096 或 ssh-keygen -t rsa -b 4096ssh-copy-id user@server_ipPubkeyAuthentication yesAuthorizedKeysFile .ssh/authorized_keysPasswordAuthentication nosudo systemctl restart ssh四 若实际要配置的是 FTPS(FTP over SSL/TLS)
sudo apt update && sudo apt install vsftpd opensslsudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/ssl/private/vsftpd.pem -out /etc/ssl/certs/vsftpd.pemssl_enable=YESallow_anon_ssl=NOforce_local_data_ssl=YESforce_local_logins_ssl=YESssl_tlsv1=YESssl_sslv2=NOssl_sslv3=NOrsa_cert_file=/etc/ssl/certs/vsftpd.pemrsa_private_key_file=/etc/ssl/private/vsftpd.pemsudo systemctl restart vsftpdsudo ufw allow 21/tcp 与 sudo ufw allow 990/tcp(显式 FTPS 常用 990/tcp;被动模式还需放行数据端口范围)openssl s_client -connect your_server_ip:21 -starttls ftp