centos安裝vsftd(ftp)伺服器方法

來源:互聯網
上載者:User

概述:

vsftpd是Linux下比較著名的FTP伺服器,搭建FTP伺服器當然首選這個。本文介紹了在CentOS 6.4下安裝vsftpd、配置虛擬使用者登入FTP的過程。

安裝vsftpd

查看是否已經安裝vsftpd

rpm -qa | grep vsftpd
如果沒有,就安裝,並設定開機啟動

yum -y install vsftpd
chkconfig vsftpd on
修改設定檔

vim /etc/vsftpd/vsftpd.conf
anonymous_enable=NO //設定不允許匿名訪問
local_enable=YES //設定本機使用者可以訪問。註:如使用虛擬宿主使用者,在該項目設定為NO的情況下所有虛擬使用者將無法訪問
chroot_list_enable=YES //使使用者不能離開主目錄
ascii_upload_enable=YES
ascii_download_enable=YES //設定支援ASCII模式的上傳和下載功能
pam_service_name=vsftpd //PAM認證檔案名稱。PAM將根據/etc/pam.d/vsftpd進行認證

添加ftp使用者

下面是添加ftpuser使用者,設定根目錄為/home/wwwroot/ftpuser,禁止此使用者登入SSH的許可權,並限制其訪問其它目錄。

同樣開啟vsftpd的設定檔

#chroot_list_enable=YES
#(default follows)
#chroot_list_file=/etc/vsftpd.chroot_list
修改為

chroot_list_enable=YES
#(default follows)
chroot_list_file=/etc/vsftpd/chroot_list
增加使用者ftpuser,指向目錄/home/wwwroot/ftpuser,禁止登入SSH許可權。

useradd -d /home/wwwroot/ftpuser -g ftp -s /sbin/nologin ftpuser
設定使用者口令

passwd ftpuser
編輯檔案chroot_list

vi /etc/vsftpd/chroot_list
`
內容為ftp使用者名稱,每個使用者佔一行,如:
peter
john

重新啟動vsftpd

service vsftpd restart
出現的錯誤1、500 OOPS: cannot change directory
解決方案:

在終端輸入命令:

setsebool -P ftpd_disable_trans 1
service vsftpd restart
原因:這是因為伺服器開啟了selinux,這限制了FTP的登入。

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.