linux下安裝vsftp

來源:互聯網
上載者:User

標籤:style   blog   io   color   ar   os   使用   sp   檔案   

linux下安裝vsftp

Linux下安裝VSFTPD可是一個技術活,但是掌握了方法之後就一切變的很簡單了。本文以CentOS 6.4為配置環境,進行vsftpd的安裝。

命令:

yum install vsftpd

 

下載VSFTPD

  Linux下傳統的安裝軟體方法是下載tar.gz安裝包,或者RPM安裝包,再經過解壓之後進行編譯,或者用RPM -i命令安裝。過程比較繁瑣,其實還有個更為簡捷的方法就是使用yum命令線上安裝,支援幾乎所有常見的軟體,它的好處是讀取多個鏡像伺服器列表中的最新版本,一切傻瓜化操作。

[[email protected] tools]# yum install vsftpdLoaded plugins: securitybase                                                                                                                                            | 3.7 kB     00:00     base/primary_db                                                                                                                                 | 4.6 MB     00:00     epel                                                                                                                                            | 4.4 kB     00:00     epel/primary_db                                                                                                                                 | 6.3 MB     00:01     extras                                                                                                                                          | 3.4 kB     00:00     extras/primary_db                                                                                                                               |  29 kB     00:00     updates                                                                                                                                         | 3.4 kB     00:00     updates/primary_db                                                                                                                              | 197 kB     00:00     Setting up Install ProcessResolving Dependencies--> Running transaction check---> Package vsftpd.x86_64 0:2.2.2-13.el6_6.1 will be installed--> Finished Dependency ResolutionDependencies Resolved======================================================================================================================================================================= Package                              Arch                                 Version                                         Repository                             Size=======================================================================================================================================================================Installing: vsftpd                               x86_64                               2.2.2-13.el6_6.1                                updates                               151 kTransaction Summary=======================================================================================================================================================================Install       1 Package(s)Total download size: 151 kInstalled size: 332 kIs this ok [y/N]: yDownloading Packages:vsftpd-2.2.2-13.el6_6.1.x86_64.rpm                                                                                                              | 151 kB     00:00     Running rpm_check_debugRunning Transaction TestTransaction Test SucceededRunning Transaction  Installing : vsftpd-2.2.2-13.el6_6.1.x86_64                                                                                                                      1/1   Verifying  : vsftpd-2.2.2-13.el6_6.1.x86_64                                                                                                                      1/1 Installed:  vsftpd.x86_64 0:2.2.2-13.el6_6.1                                                                                                                                     Complete!

 

 

  yum命令的好處已經體現出來,當輸入完安裝命令之後,首先從伺服器讀取資源,然後選擇安裝包,最後由使用者決定是否安裝,這裡我們按y確認安裝。當出現“Complete!”時意味著安裝完成。

值得注意的是,在Linux中,系統對於大小寫嚴格區分,比如abc和ABC是完全不相同的字元,要特別注意。

 

  配置Vsftpd

安裝完之後我們要對它進行配置,才能正常使用。編輯vsftpd的設定檔

vi /etc/vsftpd/vsftpd.conf

 

vi編輯器中的搜尋使命是斜杠“/”,然後輸入要尋找的內容,斷行符號確定。以下是要更改的選項

anonymous_enable=NO  #禁止匿名訪問ascii_upload_enable #允許使用ascii碼上傳ascii_download_enable #允許使用ascii碼下載userlist_deny=NO #(這條需手動添加到最後)使用FTP使用者表,表裡沒有的使用者需要添加才能登入

 

設定完畢之後,ESC,冒號wq斷行符號。啟動vsftpd服務

/etc/init.d/vsftpd start

看到[確定]即為啟動成功。

 

只啟動完還不行,還要給它添加開機自動啟動 

chkconfig vsftpd on

 添加啟動是沒有任何提示的,如果不確定是否已經加入了開機啟動項可以運行chkconfig –list進行查看。

添加使用者1、修改設定檔
vi /etc/vsftd/vsftpd.conf

增加

pam_service_name=vsftpduserlist_enable=YESuserlist_deny=NOuserlist_file=/etc/vsftpd/user_list
 2、增加訪問的使用者
vi /etc/vsftpd/user_list
3、添加拒絕訪問的使用者
vi /etc/vsftpd/ftpusers
4、啟動/etc/init.d/vsftpd start
5、netstat -ntlp檢查21連接埠是否開啟
6、iptables -nvL檢查防火牆是否開啟21連接埠
修改ftp的根目錄
 

修改ftp的根目錄只要修改/etc/vsftpd/vsftpd.conf檔案即可:

加入如下幾行:

local_root=/alidata/www/chroot_local_user=YESanon_root=/alidata/www/l

 

註:local_root 針對系統使用者;anon_root 針對匿名使用者。

重新啟動服務:

service vsftpd restart

 

任何一個使用者ftp登入到這個伺服器上都會chroot到/alidata/www目錄下。

 

linux下安裝vsftp

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.