SFTP配置中SSL TLS的正确理解与要点
方案一 强化 OpenSSH 的 SFTP 安全(推荐)
sudo apt update && sudo apt install openssh-serversudo yum install openssh-serversudo ssh-keygen -t rsa -b 4096 -f /etc/ssh/ssh_host_rsa_keysudo ssh-keygen -t ed25519 -f /etc/ssh/ssh_host_ed25519_keySubsystem sftp /usr/lib/openssh/sftp-serverProtocol 2HostKey /etc/ssh/ssh_host_rsa_key、HostKey /etc/ssh/ssh_host_ecdsa_key、HostKey /etc/ssh/ssh_host_ed25519_keyCiphers aes128-ctr,aes192-ctr,aes256-ctrMACs hmac-sha2-256,hmac-sha2-512KexAlgorithms diffie-hellman-group-exchange-sha256PubkeyAuthentication yesAuthorizedKeysFile .ssh/authorized_keyssudo systemctl restart sshdsudo firewall-cmd --permanent --add-service=ssh && sudo firewall-cmd --reloadsftp -o Port=22 username@your_server_ip方案二 使用 FTPS(FTP over SSL TLS)
证书与验证建议
快速排查清单
sudo systemctl status sshd,ss -tulnp | grep :22 确认 22/TCP 监听正常。sudo sshd -t 检查 /etc/ssh/sshd_config 语法错误后再重启。sftp -v user@host 查看协商的 Cipher/MAC/Kex 是否为预期强算法。