ÔõÑùÔÚLinuxÉÏ×°ÖúÍÉèÖÃFTPЧÀÍÆ÷
ÔõÑùÔÚlinuxÉÏ×°ÖúÍÉèÖÃftpЧÀÍÆ÷
¸ÅÊö£º
FTP (File Transfer Protocol) ÊÇÒ»ÖÖÓÃÓÚÔÚЧÀÍÆ÷ºÍ¿Í»§¶ËÖ®¼ä´«ÊäÎļþµÄÐÒé¡£ÔÚLinuxϵͳÉÏ£¬ÎÒÃÇ¿ÉÒÔʹÓÃvsftpd (Very Secure FTP Daemon) ×÷ΪFTPЧÀÍÆ÷À´ÊµÏÖÎļþ´«Êä¡£±¾ÎĽ«ÏÈÈÝÔõÑùÔÚLinuxÉÏ×°ÖúÍÉèÖÃvsftpdЧÀÍÆ÷£¬²¢ÌṩÏà¹ØµÄ´úÂëʾÀý¡£
°ì·¨1£º×°ÖÃvsftpd
ҪװÖÃvsftpdЧÀÍÆ÷£¬ÎÒÃÇ¿ÉÒÔʹÓÃÒÔÏÂÏÂÁ
sudo apt-get update sudo apt-get install vsftpd
µÇ¼ºó¸´ÖÆ
°ì·¨2£ºÉèÖÃvsftpd
×°ÖÃÍê³Éºó£¬ÎÒÃÇÐèÒª¶Ôvsftpd¾ÙÐÐһЩÉèÖá£Ä¬ÈÏÇéÐÎÏ£¬ÉèÖÃÎļþλÓÚ/etc/vsftpd.conf¡£¿ÉÒÔʹÓÃÎı¾±à¼Æ÷£¨Èçvi»ònano£©·¿ª¸ÃÎļþ¾ÙÐб༣º
sudo nano /etc/vsftpd.conf
µÇ¼ºó¸´ÖÆ
ÒÔÏÂÊÇһЩÖ÷ÒªµÄÉèÖÃÑ¡Ïî¼°Æä˵Ã÷£º
anonymous_enable£ºÉèÖÃΪYESÌåÏÖÔÊÐíÄäÃûÓû§»á¼ûFTPЧÀÍÆ÷¡£
local_enable£ºÉèÖÃΪYESÌåÏÖÔÊÐíÍâµØÓû§»á¼ûFTPЧÀÍÆ÷¡£
write_enable£ºÉèÖÃΪYESÌåÏÖÔÊÐíÓû§ÉÏ´«Îļþµ½FTPЧÀÍÆ÷¡£
chroot_local_user£ºÉèÖÃΪYESÌåÏÖÏÞÖÆÓû§µÄ¼ÒĿ¼ΪÆäµÇ¼Ŀ¼¡£
anonymous_root£ºÖ¸¶¨ÄäÃûÓû§µÄ¸ùĿ¼¡£
listen£ºÖ¸¶¨FTPЧÀÍÆ÷¼àÌýµÄIPµØµã¡£
ÀýÈ磬ÈôÊÇÎÒÃÇÏëÔÊÐíÍâµØÓû§»á¼ûFTPЧÀÍÆ÷£¬²¢ÏÞÖÆËûÃǵļÒĿ¼ΪµÇ¼Ŀ¼£¬¿ÉÒÔ¾ÙÐÐÈçÏÂÉèÖãº
anonymous_enable=YES local_enable=YES write_enable=YES chroot_local_user=YES listen=YES
µÇ¼ºó¸´ÖÆ
Íê³ÉÉèÖúó£¬ÉúÑIJ¢¹Ø±ÕÎļþ¡£
°ì·¨3£ºÖØÆôvsftpdЧÀÍÆ÷
ÎÒÃÇÐèÒªÖØÐÂÆô¶¯vsftpdЧÀÍÆ÷ÒÔʹÉèÖÃÉúЧ£º
sudo systemctl restart vsftpd
µÇ¼ºó¸´ÖÆ
°ì·¨4£ºÉèÖ÷À»ðǽ¹æÔò
ÈôÊÇÄúµÄLinuxϵͳÆôÓÃÁË·À»ðǽ£¬ÄúÐèÒªÉèÖ÷À»ðǽÒÔÔÊÐíFTPÁ÷Á¿Í¨¹ý¡£ÒÔÏÂʾÀýչʾÁËÔõÑùʹÓÃufw£¨Uncomplicated Firewall£©À´ÉèÖ÷À»ðǽ¹æÔò£º
sudo ufw allow 20/tcp sudo ufw allow 21/tcp sudo ufw enable
µÇ¼ºó¸´ÖÆ
Õ⽫ÔÊÐíTCP¶Ë¿Ú20ºÍ21µÄ´«ÈëÅþÁ¬£¬²¢ÆôÓÃufw·À»ðǽ¡£
°ì·¨5£º²âÊÔFTPЧÀÍÆ÷
ÏÖÔÚ£¬ÄúµÄFTPЧÀÍÆ÷ÒѾװÖò¢ÉèÖÃÍê³É¡£Äú¿ÉÒÔʹÓÃFTP¿Í»§¶Ë£¨ÈçFileZilla£©ÅþÁ¬µ½Ð§ÀÍÆ÷À´²âÊÔ¡£
ʹÓÃFileZillaÅþÁ¬FTPЧÀÍÆ÷µÄʾÀý°ì·¨£º
·¿ªFileZilla²¢µã»÷¡°Îļþ¡±-¡°Õ¾µãÖÎÀíÆ÷¡±¡£
ÔÚÕ¾µãÖÎÀíÆ÷ÖУ¬µã»÷¡°ÐÂÕ¾µã¡±²¢ÊäÈëÏà¹ØÐÅÏ¢£¨ÈçÖ÷»úÃû¡¢¶Ë¿Ú¡¢Óû§ÃûºÍÃÜÂ룩¡£
µã»÷¡°ÅþÁ¬¡±°´Å¥£¬FileZilla½«ÊµÑéÅþÁ¬µ½FTPЧÀÍÆ÷¡£
ÈôÊÇÅþÁ¬Àֳɣ¬Äú½«Äܹ»¿´µ½FTPЧÀÍÆ÷ÉϵÄÎļþºÍĿ¼¡£
´úÂëʾÀý£º
±àдһ¸ö¼òÆÓµÄShell½ÅÔÀ´½¨ÉèFTPÓû§ºÍÉèÖÃÆäÃÜÂ룺
#!/bin/bash echo "ÇëÊäÈëÓû§Ãû£º" read username echo "ÇëÊäÈëÃÜÂ룺" read -s password sudo useradd $username -m -s /bin/bash sudo echo -e "$password $password" | sudo passwd $username sudo chown $username:$username /home/$username sudo chmod 755 /home/$username sudo systemctl restart vsftpd
µÇ¼ºó¸´ÖÆ
Çë×¢ÖØ£¬ÔÚÔËÐо籾֮ǰ£¬È·±£ÄúÔÚLinuxϵͳÉϾßÓÐsudoȨÏÞ¡£
½áÂÛ£º
×°ÖúÍÉèÖÃFTPЧÀÍÆ÷ÊÇLinuxϵͳÖÎÀíÖеij£¼ûʹÃü¡£Í¨¹ýʹÓÃvsftpdЧÀÍÆ÷£¬¿ÉÒÔÀû±ãµØʵÏÖÎļþ´«Êä¡£ÔÚ±¾ÎÄÖУ¬ÎÒÃÇÏêϸÏÈÈÝÁËÔõÑùÔÚLinuxÉÏ×°ÖúÍÉèÖÃvsftpdЧÀÍÆ÷£¬²¢ÌṩÁËÏà¹ØµÄ´úÂëʾÀý¡£Ï£Íû±¾ÎĶÔÄúÓÐËù×ÊÖú£¡
ÒÔÉϾÍÊÇÔõÑùÔÚLinuxÉÏ×°ÖúÍÉèÖÃFTPЧÀÍÆ÷µÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡