
- Linux管理員教程
- 首頁
- CentOS概述
- 基本CentOS Linux命令
- 檔案/資料夾管理
- 使用者管理
- 配額管理
- Systemd服務啟動和停止
- 使用systemctl進行資源管理
- 使用cgroups進行資源管理
- 程序管理
- 防火牆設定
- 在CentOS Linux中配置PHP
- 使用CentOS Linux設定Python
- 在CentOS Linux上配置Ruby
- 為CentOS Linux設定Perl
- 安裝和配置Open LDAP
- 建立SSL證書
- 安裝Apache Web伺服器CentOS 7
- 在CentOS 7上設定MySQL
- 設定Postfix MTA和IMAP/POP3
- 安裝匿名FTP
- 遠端管理
- CentOS中的流量監控
- 日誌管理
- 備份和恢復
- 系統更新
- Shell指令碼
- 包管理
- 卷管理
- Linux管理員有用資源
- Linux管理員 - 快速指南
- Linux管理員 - 有用資源
- Linux管理員 - 討論
Linux管理員 - 安裝匿名FTP
在深入探討如何在CentOS上安裝FTP之前,我們需要了解一些關於其用途和安全性的知識。FTP是一種非常高效且完善的協議,用於在計算機系統之間傳輸檔案。FTP已經使用和完善了幾十年了。對於在網路上以低延遲或高速高效地傳輸檔案,FTP是一個不錯的選擇。它優於SAMBA或SMB。
但是,FTP確實存在一些安全問題。實際上,是一些嚴重的安全問題。FTP使用了一種非常弱的明文身份驗證方法。因此,經過身份驗證的會話應依賴於sFTP或FTPS,其中TLS用於對登入和傳輸會話進行端到端加密。
考慮到上述警告,傳統的FTP在當今的商業環境中仍然有用。主要用途是匿名FTP檔案儲存庫。在這種情況下,無需身份驗證即可下載或上傳檔案。匿名FTP的一些示例用途如下:
大型軟體公司仍然使用匿名ftp儲存庫,允許網際網路使用者下載共享軟體和補丁。
允許網際網路使用者上傳和下載公共文件。
某些應用程式會透過FTP自動將加密的存檔日誌或配置檔案傳送到儲存庫。
因此,作為CentOS管理員,能夠安裝和配置FTP仍然是一項重要的技能。
我們將使用一個名為vsFTP(Very Secure FTP Daemon)的FTP守護程序。vsFTP已在開發中使用了一段時間。它以安全、易於安裝和配置以及可靠而聞名。
步驟1 - 使用YUM包管理器安裝vsFTPd。
[root@centos]# yum -y install vsftpd.x86_64
步驟2 - 配置vsFTP在啟動時使用systemctl啟動。
[root@centos]# systemctl start vsftpd [root@centos]# systemctl enable vsftpd Created symlink from /etc/systemd/system/multi- user.target.wants/vsftpd.service to /usr/lib/systemd/system/vsftpd.service.
步驟3 - 配置FirewallD以允許FTP控制和傳輸會話。
[root@centos]# firewall-cmd --add-service=ftp --permanent success [root@centos]#
確保我們的FTP守護程序正在執行。
[root@centos]# netstat -antup | grep vsftp tcp6 0 0 :::21 :::* LISTEN 13906/vsftpd [root@centos]#
步驟4 - 為匿名訪問配置vsFTPD。
建立FTP根目錄
[root@centos]# mkdir /ftp
將FTP根目錄的所有者和組更改為ftp
[root@centos]# chown ftp:ftp /ftp Set minimal permissions for FTP root: [root@centos]# chmod -R 666 /ftp/ [root@centos]# ls -ld /ftp/ drw-rw-rw-. 2 ftp ftp 6 Feb 27 02:01 /ftp/ [root@centos]#
在本例中,我們授予使用者對整個FTP根樹的讀寫許可權。
配置/etc/vsftpd/vsftpd.conf"
[root@centos]# vim /etc/vsftpd/vsftpd.conf # Example config file /etc/vsftpd/vsftpd.conf # # The default compiled in settings are fairly paranoid. This sample file # loosens things up a bit, to make the ftp daemon more usable. # Please see vsftpd.conf.5 for all compiled in defaults. # # READ THIS: This example file is NOT an exhaustive list of vsftpd options. # Please read the vsftpd.conf.5 manual page to get a full idea of vsftpd's # capabilities.
我們需要更改vsftp.conf檔案中的以下指令。
透過取消註釋anon_mkdir_write_enable=YES來啟用匿名上傳
將上傳的檔案的所有者更改為系統ftp使用者
chown_uploads = YES
chown_username = ftp
將vsftp使用的系統使用者更改為ftp使用者:nopriv_user = ftp
設定使用者在登入前閱讀的自定義橫幅。
ftpd_banner = 歡迎使用我們的匿名FTP儲存庫。所有連線都將被監控和記錄。
讓我們僅設定IPv4連線 -
listen = YES
listen_ipv6 = NO
現在,我們需要重新啟動或HUP vsftp服務以應用我們的更改。
[root@centos]# systemctl restart vsftpd
讓我們連線到我們的FTP主機並確保我們的FTP守護程序正在響應。
[root@centos rdc]# ftp 10.0.4.34 Connected to localhost (10.0.4.34). 220 Welcome to our Anonymous FTP Repo. All connections are monitored and logged. Name (localhost:root): anonymous 331 Please specify the password. Password: '230 Login successful. Remote system type is UNIX. Using binary mode to transfer files. ftp>