CentOS6.8 安裝FTP及添加使用者,centos6.8ftp

來源:互聯網
上載者:User

CentOS6.8 安裝FTP及添加使用者,centos6.8ftp

一 安裝FTP

1 檢測是否已經安裝FTP

rpm -qa | grep vsftpd

2 若沒有,則進行安裝

yum install vsftpd

二 設定vsftpd開機啟動

chkconfig --level 35 vsftpd on

三 配置FTP伺服器(開啟基於使用者的存取控制)

1 設定檔的修改

vim /etc/vsftpd/vsftpd.conf
anonymous_enable=NO   # 是否開啟匿名登入local_enable=YES     # 是否允許本機使用者登入write_enable=YES   # 是否允許上傳local_umask=022     # 預設的umask碼diremssage_enable=YES   # 是否顯示目錄說明檔案xferlog_enable=YES   # 是否記錄ftp傳輸過程connect_from_prot_20=YES  # 是否確定連接埠傳輸來自20xferlog_ftd_format=YES     # 是否使用標準的ftp xferlog模式chroot_list_enable=YES   # 是否將系統使用者限制在自己的home目錄下chroot_list_file=/etc/vsftpd/chroot_list    # 列表不受限制的使用者listen=YES     # 是否開啟監聽pam_service_name=vsftpd  # 服務名稱userlist_enable=YEStcp_wrappers=YES

2 修改selinux

getsebool -a | grep ftp

若報錯,getsebool:  SELinux is disabled。則

vim /etc/selinux/config

修改 SELINUX=1。

然後重啟LINUX,"shutdown -r now" 立刻重啟(root使用者使用)。

重新執行 "getsebool -a | grep ftp"

修改selinux,允許使用者在家目錄寫入資料

setsebool -P allow_ftpd_anon_write offsetsebool -P ftp_home_dir on

四 建立虛擬使用者

1 建立一個使用者,然後修改使用者的登陸shell為nologin,讓使用者不能登陸系統,只能使用ftp之內的服務

// 指定使用者 test 屬於組 ftp,只能訪問的目錄是 /home/www/test,不能登陸系統useradd -d /home/www/test -g ftp -s /sbin/nologin test// 設定該使用者的密碼passwd test

2 把使用者 test 添加到chroot_list中

// 把 test 加入該檔案vim /etc/vsftpd/chroot_list

五 測試虛擬使用者

在瀏覽器的地址欄輸入 "ftp://你的ip",在彈出的對話方塊中輸入帳號、密碼,即可串連成功。

六 其他配置

開啟設定檔 vsftpd.conf

max_client=100     # vsftpd最大支援連結數100個IP
max_per=5      # 每個IP能支援5個連結

local_max_rate=81920   # 限制傳輸速度

listen_address=某個IP    # 綁定某個IP到vsftpd,只允許該IP訪問

xferlog_file=/var/log/vsftpd.log   # 日誌存放位置

聯繫我們

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