# FTP, FTPS आणि SFTP मधला फरक

Source: https://ravindrabagale.com/mr/cyber/part-01/ch02-ports-and-protocols-ssh-http-https-ftp-sftp-and/2-5-ftp-and-sftp.html
Language: mr (Marathi with English technical terms)

FTP जुना file-transfer protocol आहे. काही hosting setups मध्ये तो अजून दिसतो. Plain FTP ची मोठी अडचण म्हणजे username आणि password clear text मध्ये जातात.

 | Point
 | FTP
 | FTPS
 | SFTP

 | Port
 | 21 (control) + 20 or random (data)
 | 21/990 + data ports
 | 22 (SSH वर चालतो)

 | Encryption
 | नाही
 | TLS
 | SSH

 | Firewall configure करणं
 | गुंतागुंतीचं (वेगळे data ports)
 | गुंतागुंतीचं
 | सोपं (एक port)

 | वापरावा का?
 | नाही
 | गरज असेल तरच
 | हो

FTP: control साठी port 21 आणि data साठी port 20 किंवा negotiated ports; encryption नसतं. FTPS: FTP ला TLS जोडतो; configuration नुसार 21/990 आणि वेगळे data ports लागतात. SFTP: SSH वर चालणारा स्वतंत्र file-transfer protocol; साधारण port 22 आणि SSH encryption वापरतो.

FTP/FTPS च्या वेगळ्या data connections मुळे firewall configuration अधिक गुंतागुंतीचं होतं. SFTP ला एकच connection लागतो. Plain FTP टाळा; आवश्यक compatibility असेल तेव्हाच FTPS विचारात घ्या. SSH उपलब्ध असेल तर SFTP सोयीचा पर्याय आहे.

Files transfer करून पाहा

sftp -i mykey.pem ec2-user@<PUBLIC_IP>     # then: put file.txt, get file.txt, ls, bye
scp -i mykey.pem report.pdf ubuntu@<PUBLIC_IP>:~/

sftp मध्ये login झाल्यावर put file.txt ने upload, get file.txt ने download, ls ने listing आणि bye ने exit करता येतं. scp command उदाहरणात report.pdf remote user च्या home directory मध्ये copy करते.

Security मध्ये उपयोग

Plain FTP traffic capture केल्यावर credentials वाचता येऊ शकतात. Part 10 मधल्या controlled Wireshark lab मध्ये याचा अर्थ समजेल. Anonymous FTP आणि जुने vulnerable FTP servers हे training labs मधले परिचित examples आहेत; Metasploitable 2 मध्येही असा server आहे. प्रत्यक्ष system वर file transfer साठी SSH वरचं SFTP/SCP वापरा.

Practice

तुमच्या Linux lab machine ला sftp ने connect व्हा. एक test file upload करा, listing मध्ये ती दिसते का पाहा, परत download करा आणि bye ने बाहेर पडा.

रवींद्र बागले यांची tip

EC2 वर files upload करायला वेगळं vsftpd install करून port 21 उघडण्याची गरज नसते. SSH चालू असेल तर WinSCP, FileZilla किंवा MobaXterm मध्ये SFTP, port 22 आणि तुमची key निवडा. अनावश्यक service उघडी ठेवणं टाळा.
