阿里云 ECS 服務(wù)器 CentOS 7.4 搭建 LAMP WordPress 環(huán)境:vsftp 文件服務(wù)

三含衔、搭建共享文件服務(wù)

本來只想搭建 Samba 服務(wù)的,但是 WordPress 有 FTP 的設(shè)置,而且如果你使用 Dreamweaver 來開發(fā)的話,也有 FTP 支持......谓娃!

NFS / Samba / FTP 都是文件服務(wù)器的。

鳥哥鏈接 : http://cn.linux.vbird.org/linux_server/

安裝 FTP 服務(wù)

鳥哥 FTP 鏈接 :http://cn.linux.vbird.org/linux_server/0410vsftpd_1.php

鳥哥的 Linux 私房菜 -- 服務(wù)器架設(shè)篇目錄 FTP

vsftpd蜒滩,vsftpd 文檔

開始安裝 vsftpd 服務(wù)

查看 yum 上的版本

[root@~]# yum list | grep "vsftpd\."
vsftpd.x86_64                              3.0.2-22.el7               base      

安裝 vsftpd

[root@~]# yum -y install vsftpd
......
Total download size: 169 k
Installed size: 348 k
Downloading packages:
vsftpd-3.0.2-22.el7.x86_64.rpm           | 169 kB  00:00:00 
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : vsftpd-3.0.2-22.el7.x86_64          1/1 
  Verifying  : vsftpd-3.0.2-22.el7.x86_64          1/1 

Installed:
  vsftpd.x86_64 0:3.0.2-22.el7                                    

Complete!

查看安裝完成的文件

[root@~]# ls /etc/ | grep "vsftpd"
vsftpd

[root@~]# ls /etc/pam.d/ | grep "vsftpd"
vsftpd

[root@~]# ls /var/ | grep "ftp"
ftp

[root@~]# whereis vsftpd
vsftpd: /usr/sbin/vsftpd /etc/vsftpd /usr/share/man/man8/vsftpd.8.gz

查看服務(wù)

[root@~]# systemctl list-unit-files vsftpd.service
UNIT FILE      STATE   
vsftpd.service disabled

1 unit files listed.

使能服務(wù)

[root@~]# systemctl enable vsftpd
Created symlink from /etc/systemd/system/multi-user.target.wants/vsftpd.service to /usr/lib/systemd/system/vsftpd.service.

[root@~]# systemctl list-unit-files vsftpd.service
UNIT FILE      STATE  
vsftpd.service enabled

1 unit files listed.

配置 vsftpd 服務(wù)

查看配置文件內(nèi)容 vsftpd.conf

[root@~]# cat /etc/vsftpd/vsftpd.conf | grep -v "^ *#" | grep -v "^$"
anonymous_enable=YES 
local_enable=YES
write_enable=YES
local_umask=022
dirmessage_enable=YES
xferlog_enable=YES
connect_from_port_20=YES
xferlog_std_format=YES
listen=NO
listen_ipv6=YES
pam_service_name=vsftpd
userlist_enable=YES
tcp_wrappers=YES

它一共分三種類型的設(shè)置:BOOLEAN OPTIONS(布爾型)滨达,NUMERIC OPTIONS(數(shù)字型)奶稠,STRING OPTIONS(字符型);

一一解析......

anonymous_enable=YES // 控制匿名登錄是否合法捡遍。如果是 YES锌订,用戶名是 ftp 和 anonymous都被識(shí)別為匿名登錄;

local_enable=YES // 控制本地登錄是否合法画株。如果是 YES辆飘,在 /etc/passwd 下的普通用戶可以用于登錄。這必須要允許任意的非匿名用戶和虛擬用戶可以登錄進(jìn)去進(jìn)行工作谓传。

write_enable=YES // 控制可以用于改變文件系統(tǒng)的 FTP 命令蜈项。這些命令是:STOR, DELE, RNFR, RNTO, MKD, RMD, APPE 和 SITE。

local_umask=022 // !這個(gè)值是為本地用戶創(chuàng)建文件設(shè)置的掩碼值良拼。注意战得!如果你想要一個(gè)特殊的八進(jìn)制值一定要使用“0”前綴,不然這個(gè)值會(huì)被當(dāng)成十進(jìn)制值處理庸推。

dirmessage_enable=YES // 如果啟用了,當(dāng) FTP 服務(wù)的用戶第一次進(jìn)入一個(gè)新的目錄的時(shí)候會(huì)顯示一些信息浇冰。默認(rèn)的贬媒,一個(gè)目錄是可以掃描到 .message 文件的,但是可以設(shè)置配置來覆蓋 message_file.

xferlog_enable=YES //如果啟用了肘习,會(huì)有一個(gè)日志文件記錄著上傳和下載的詳細(xì)細(xì)節(jié)际乘。默認(rèn)的,這個(gè)文件會(huì)放到 var/log/vsftpd.log 處漂佩,但是這個(gè)路徑可以通過設(shè)置 vsftp_log_file 配置項(xiàng)來覆蓋掉脖含。

connect_from_port_20=YES // 這個(gè)是控制著在服務(wù)器里面是否使用端口號(hào) 20 (ftp-data)進(jìn)行數(shù)據(jù)連接。出于安全的因素投蝉,一些客戶會(huì)堅(jiān)持使用這個(gè)端口進(jìn)行數(shù)據(jù)連接养葵。相反地,禁用此選項(xiàng)可使 vsftpd 以較低的權(quán)限運(yùn)行瘩缆。

xferlog_std_format=YES // 如果啟用了关拒,傳輸日志文件會(huì)以標(biāo)準(zhǔn)的 xferlog 的格式寫入,就像 wu-ftp 所使用的格式一樣庸娱。這是非常有用的着绊,因?yàn)槟憧梢灾赜靡呀?jīng)存在的傳輸統(tǒng)計(jì)生成器。然而熟尉,默認(rèn)地格式會(huì)更易讀归露。這個(gè)樣式的傳輸日志文件的默認(rèn)路徑在 /var/log/xferlog,但是你可以通過修改 xferlog_file 這個(gè)配置項(xiàng)來修改這個(gè)路徑斤儿。

listen=NO // 如果啟用了剧包,vsftpd 會(huì)以獨(dú)立模式運(yùn)行腮考。這意味著 vsftpd 不能在類似 inetd 上運(yùn)行。相對(duì)地玄捕,vsftpd 只會(huì)運(yùn)行一次踩蔚。然后,vsftpd將負(fù)責(zé)監(jiān)聽和處理傳入的連接枚粘。

listen_ipv6=YES // 與 listen 參數(shù)一樣馅闽,vsftpd 將監(jiān)聽 IPv6 套接字而不是 IPv4套接字。這個(gè)參數(shù)和 lisent 參數(shù)是相互排斥的馍迄,就是只能設(shè)置其中一個(gè)參數(shù)為 YES福也。

pam_service_name=vsftpd // 這個(gè)字符串是 vsftpd 使用的 PAM 服務(wù)名。

userlist_enable=YES // 如果啟用了攀圈,vsftpd 會(huì)從 userlist_flie 配置項(xiàng)提供的文件名中加載一個(gè)用戶名列表暴凑。如果用戶嘗試使用這個(gè)文件的名稱進(jìn)行登錄,在請(qǐng)求密碼前他們會(huì)被拒絕赘来。這個(gè)在防止明文傳輸時(shí)會(huì)非常有用现喳。另外可以看看 userlist_deny 配置項(xiàng)。

tcp_wrappers=YES // 如果啟用了犬辰,vsftpd 會(huì)使用 tcp_wrappers 進(jìn)行編譯嗦篱,傳入連接將會(huì)通過 tcp_wrappers 控制訪問。此外幌缝,還存在基于每個(gè) IP 配置的機(jī)制灸促。如果 tcp_wrappers 設(shè)置 VSFTPD_LOAD_CONF 環(huán)境變量,則 vsftpd 會(huì)話將嘗試加載此變量中指定的 vsftpd 配置文件涵卵。

可以使用 man 5 vsftpd.conf 快速查看所有的配置項(xiàng)

[root@~]#  man 5 vsftpd.conf
VSFTPD.CONF(5)                              File Formats Manual                              VSFTPD.CONF(5)

NAME
       vsftpd.conf - config file for vsftpd

DESCRIPTION
       vsftpd.conf  may  be used to control various aspects of vsftpd's behaviour. By default, vsftpd looks
       for this file at the location /etc/vsftpd/vsftpd.conf.  However, you may override this by specifying
       a  command  line  argument to vsftpd. The command line argument is the pathname of the configuration
       file for vsftpd. This behaviour is useful because you may wish to use  an  advanced  inetd  such  as
       xinetd to launch vsftpd with different configuration files on a per virtual host basis.

       Systemd changes the vsftpd daemon start-up. The vsftpd package contains vsftpd-generator script gen‐
       erating symbolic links to /var/run/systemd/generator/vsftpd.target.wants directory. The generator is
       called  during e. g. 'systemctl --system daemon-reload'. All these symbolic links link /usr/lib/sys‐
       temd/system/vsftpd@.service file.  The vsftpd daemon(s) is/are controlled by one of following ways:

       1. Single daemon using default /etc/vsftpd/vsftpd.conf configuration file
       # systemctl {start,stop,...} vsftpd[.service]

       2. Single daemon using /etc/vsftpd/<config-filename>.conf
       # systemctl {start,stop,...} vsftpd@<config-filename-without-extension>[.service]

       3. All instances together
       # systemctl {restart,stop} vsftpd.target

       See systemd.unit(5), systemd.target(5) for further details.

FORMAT
       The format of vsftpd.conf is very simple. Each line is either a  comment  or  a  directive.  Comment
       lines start with a # and are ignored. A directive line has the format:

       option=value

       It is important to note that it is an error to put any space between the option, = and value.

       Each setting has a compiled in default which may be modified in the configuration file.

BOOLEAN OPTIONS
.......

以下的配置與鳥哥里面的 21.2.5 CentOS 的 vsftpd 默認(rèn)值 幾乎一致浴栽。

開始配置吧!

Step 01

使用 Standalone 模式轿偎;Enter 后典鸡,使用鍵盤上的 n 鍵可以跳到下一個(gè) listen 字符處 ,修改完成后,vim 里面使用按 ESC 后贴硫,:w 保存

[root@~]# vim +/listen /etc/vsftpd/vsftpd.conf
listen=NO -- 修改成 --> linsten=YES
listen_ipv6=YES -- 修改成 --> listen_ipv6=NO

Step 02

vsftpd 默認(rèn)使用格林威治時(shí)間 (GMT) 疤坝,修改成本地時(shí)間, vim 里面 :200 再按 o 鍵憾股,末行寫入以下內(nèi)容喜每;按 ESC 后企蹭, :w 保存

use_localtime=YES

Step 03

設(shè)置實(shí)體帳號(hào)相關(guān)信息

vim 內(nèi)使用 :/local_umask 跳到 local_umask 修改如下

local_umask=022 -- 修改成 --> local_umask=002 // 最終權(quán)限為 775

擴(kuò)展--權(quán)限:
1、r+w+x = 2^2 + 2^1 + 2^0 = 4 + 2 + 1 = 7;
2挖诸、777(111111111) ^(異或) 002(000000010) = 775(111111101)

如 test.txt : 775 指 root 用戶可讀寫可執(zhí)行汁尺,root 用戶組可讀寫可執(zhí)行,others (其他人) 可讀不可寫可執(zhí)行多律。

例子:

[root@~]# touch test.txt
[root@~]# ls -la | grep "test"
-rw-r--r--   1 root   root         0 Sep 19 11:58 test.txt
[root@~]# chmod 775 test.txt
[root@~]# ls -la | grep "test"
-rwxrwxr-x   1 root   root         0 Sep 19 11:58 test.txt
[root@~]# chmod 777 test.txt
[root@~]# ls -la | grep "test"
-rwxrwxrwx   1 root   root         0 Sep 19 11:58 test.txt
[root@~]# chmod 177 test.txt
[root@~]# ls -la | grep "test"
---xrwxrwx   1 root   root         0 Sep 19 11:58 test.txt

使能用戶列表痴突,在 local_umask 下一行添加如下內(nèi)容

userlist_enable=YES
userlist_deny=YES
userlist_file=/etc/vsftpd/user_list

一一解析:

userlist_enable // If enabled, vsftpd will load a list of usernames, from the filename given by userlist_file. If a user tries to log in using a name in this file, they will be denied before they are asked for a password. This may be useful in preventing cleartext passwords being transmitted. See also userlist_deny.

userlist_deny // This option is examined if userlist_enable is activated. If you set this setting to NO, then users will be denied login unless they are explicitly listed in the file specified by userlist_file. When login is denied, the denial is issued before the user is asked for a password.

userlist_file //This option is the name of the file loaded when the userlist_enable option is active. Default: /etc/vsftpd/user_list

Step 04

增加歡迎信息搂蜓,vim 內(nèi)定位到 :/tcp_wrappers 在其下面寫入如下內(nèi)容

banner_file=/etc/vsftpd/welcome.txt

banner_file // This option is the name of a file containing text to display when someone connects to the server. If set, it overrides the banner string provided by the ftpd_banner option.

創(chuàng)建 welcome.txt 文件及內(nèi)容

[root@~]# touch /etc/vsftpd/welcome.txt

[root@~]# vim /etc/vsftpd/welcome.txt 

[root@~]# cat /etc/vsftpd/welcome.txt 

歡迎光臨 Deepppixel 網(wǎng)站!本站提供 FTP 服務(wù)辽装!
如有問題請(qǐng)聯(lián)系 Deepppixel !

Step 05

登記要限制登錄的系統(tǒng)用戶

查看所有的系統(tǒng)用戶

[root@~]# cat/etc/passwd
root:x:0:0:root:/root:/bin/bash
bin:x:1:1:bin:/bin:/sbin/nologin
daemon:x:2:2:daemon:/sbin:/sbin/nologin
adm:x:3:4:adm:/var/adm:/sbin/nologin
lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin
sync:x:5:0:sync:/sbin:/bin/sync
shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown
halt:x:7:0:halt:/sbin:/sbin/halt
mail:x:8:12:mail:/var/spool/mail:/sbin/nologin
operator:x:11:0:operator:/root:/sbin/nologin
games:x:12:100:games:/usr/games:/sbin/nologin
ftp:x:14:50:FTP User:/var/ftp:/sbin/nologin
nobody:x:99:99:Nobody:/:/sbin/nologin
systemd-network:x:192:192:systemd Network Management:/:/sbin/nologin
dbus:x:81:81:System message bus:/:/sbin/nologin
polkitd:x:999:997:User for polkitd:/:/sbin/nologin
postfix:x:89:89::/var/spool/postfix:/sbin/nologin
chrony:x:998:996::/var/lib/chrony:/sbin/nologin
sshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologin
ntp:x:38:38::/etc/ntp:/sbin/nologin
tcpdump:x:72:72::/:/sbin/nologin
nscd:x:28:28:NSCD Daemon:/:/sbin/nologin
apache:x:48:48:Apache:/usr/share/httpd:/sbin/nologin
mysql:x:27:27:MySQL Server:/var/lib/mysql:/bin/bash
saslauth:x:997:76:Saslauthd user:/run/saslauthd:/sbin/nologin

解析:

  • root:x:0:0:root:/root:/bin/bash
  • 用戶名:密碼:UID:GID:用戶描述: home 目錄

把 UID < 500 有寫入 /etc/vsftpd/ftpusers [黑名單] 和 /etc/vsftpd/user_list [白名單] 兩個(gè)文件中帮碰,它們的內(nèi)容是一樣的

[root@~]# vim /etc/vsftpd/user_list
root
bin
daemon
adm
lp
sync
shutdown
halt
mail
news
uucp
operator
games
nobody
// 下面是新添加的
ftp
systemd-network
dbus
postfix
sshd
ntp
tcpdump
nscd
apache
mysql

補(bǔ)充說明:

  • /etc/vsftpd/ftpusers : 由 PAM 模塊管理,受 /etc/pam.d/vsftpd 配置的影響拾积;
  • /etc/vsftpd/user_list : 由 vsftpd 主動(dòng)提供殉挽,受 vsftpd.conf 的 userlist_file 配置項(xiàng)影響;

啟動(dòng) vsftpd 服務(wù)

[root@~]# systemctl status vsftpd.service
● vsftpd.service - Vsftpd ftp daemon
   Loaded: loaded (/usr/lib/systemd/system/vsftpd.service; enabled; vendor preset: disabled)
   Active: inactive (dead)

[root@~]# systemctl start vsftpd.service
[root@~]# systemctl status vsftpd.service
● vsftpd.service - Vsftpd ftp daemon
   Loaded: loaded (/usr/lib/systemd/system/vsftpd.service; enabled; vendor preset: disabled)
   Active: active (running) since Wed 2018-09-19 15:44:15 CST; 2s ago
  Process: 28777 ExecStart=/usr/sbin/vsftpd /etc/vsftpd/vsftpd.conf (code=exited, status=0/SUCCESS)
 Main PID: 28778 (vsftpd)
   CGroup: /system.slice/vsftpd.service
           └─28778 /usr/sbin/vsftpd /etc/vsftpd/vsftpd.conf

Sep 19 15:44:15 izwz9dnfbgdn5tleje5eitz systemd[1]: Starting Vsftpd ftp daemon...
Sep 19 15:44:15 izwz9dnfbgdn5tleje5eitz systemd[1]: Started Vsftpd ftp daemon.

[root@~]# netstat -tulnp| grep 21
tcp        0      0 0.0.0.0:21              0.0.0.0:*               LISTEN      28778/vsftpd

使用 FTP 測(cè)試一下吧拓巧!

如果沒有 ftp 就安裝

[root@~]# yum -y install ftp
......
Total download size: 61 k
Installed size: 96 k
Downloading packages:
ftp-0.17-67.el7.x86_64.rpm                                                             |  61 kB  00:00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : ftp-0.17-67.el7.x86_64                                                                     1/1 
  Verifying  : ftp-0.17-67.el7.x86_64                                                                     1/1 

Installed:
  ftp.x86_64 0:0.17-67.el7                                                                                    

Complete!

創(chuàng)建一個(gè)測(cè)試用戶 ftpTest斯碌,密碼:123456

[root@~]# useradd ftpTest

[root@izwz9dnfbgdn5tleje5eitz ~]# passwd ftpTest
Changing password for user ftpTest.
New password:  // 123456
BAD PASSWORD: The password is shorter than 8 characters
Retype new password: // 123456
passwd: all authentication tokens updated successfully

刪除用戶: userdel -r ftpTest

開始測(cè)試

[root@~]# ftp localhost
Trying 127.0.0.1...
Connected to localhost (127.0.0.1).
220-
220-歡迎光臨 Deepppixel 網(wǎng)站!本站提供 FTP 服務(wù)肛度!
220-如有問題請(qǐng)聯(lián)系 Deepppixel !
220-
220 
Name (localhost:root): ftpTest
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> bye
221 Goodbye.
[root@~]# ftp localhost
Trying 127.0.0.1...
Connected to localhost (127.0.0.1).
220-
220-歡迎光臨 Deepppixel 網(wǎng)站傻唾!本站提供 FTP 服務(wù)!
220-如有問題請(qǐng)聯(lián)系 Deepppixel !
220-
220 
Name (localhost:root): mysql
530 Permission denied.
Login failed.
ftp> bye
221 Goodbye.

Step 06

打開 chroot 配置承耿,保護(hù)系統(tǒng)

[root@~]# vim +/chroot /etc/vsftpd/vsftpd.conf
chroot_local_user=YES
chroot_list_enable=YES
chroot_list_file=/etc/vsftpd/chroot_list

一一解析:

chroot_local_user // If set to YES, local users will be (by default) placed in a chroot() jail in their home directory after login. Warning: This option has security implications, especially if the users have upload permission, or shell access. Only enable if you know what you are doing. Note that these security implications are not vsftpd specific. They apply to all FTP daemons which offer to put local users in chroot() jails.

chroot_list_enable // If activated, you may provide a list of local users who are placed in a chroot() jail in their home directory upon login. The meaning is slightly different if chroot_local_user is set to YES. In this case, the list becomes a list of users which are NOT to be placed in a chroot() jail. By default, the file containing this list is /etc/vsftpd.chroot_list, but you may override this with the chroot_list_file setting.

chroot_list_file // The option is the name of a file containing a list of local users which will be placed in a chroot() jail in their home directory. This option is only relevant if the option chroot_list_enable is enabled. If the option chroot_local_user is enabled, then the list file becomes a list of users to NOT place in a chroot() jail. Default: /etc/vsftpd.chroot_list

創(chuàng)建 chroot_list 文件

[root@~]# touch /etc/vsftpd/chroot_list

重啟 vsftp.service 服務(wù)

[rppt@~]# systemctl restart vsftpd.service

測(cè)試一下 ftpTest

[root@~]# ftp localhost
Trying 127.0.0.1...
Connected to localhost (127.0.0.1).
220-
220-歡迎光臨 Deepppixel 網(wǎng)站冠骄!本站提供 FTP 服務(wù)!
220-如有問題請(qǐng)聯(lián)系 Deepppixel !
220-
220 
Name (localhost:root): ftpTest
331 Please specify the password.
Password:
500 OOPS: chroot
Login failed.
421 Service not available, remote server has closed connection
ftp> bye
221 Goodbye.

因?yàn)?chroot 沒有添加到 /etc/vsftpd/chroot_list 中瘩绒,所以直接登錄失敗猴抹,有效防止不被允許的用戶登錄 FTP ,破壞系統(tǒng)锁荔。

添加 ftpTest ,再測(cè)試一下

[root@~]# vim /etc/vsftpd/chroot_list
ftpTest

重啟 vsftp.service 服務(wù)

[rppt@~]# systemctl restart vsftpd.service

測(cè)試

[root@~]# ftp localhost
Trying 127.0.0.1...
Connected to localhost (127.0.0.1).
220-
220-歡迎光臨 Deepppixel 網(wǎng)站蝙砌!本站提供 FTP 服務(wù)阳堕!
220-如有問題請(qǐng)聯(lián)系 Deepppixel !
220-
220 
Name (localhost:root): ftpTest
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> bye
221 Goodbye.

為 ftpTest 指定登錄的根目錄

[root@~]# im /etc/vsftpd/vsftpd.conf
# root user home
local_root=/var/ftp/
# 
 chroot_local_user=YES
# anonymous user home
anon_root=/var/www/html
#
allow_writeable_chroot=YES
# others user home
user_config_dir=/etc/vsftpd/userconfig

正式添加根目錄

[root@~]# mkdir -p/etc/vsftpd/userconfig

[root@~]# vim /etc/vsftpd/userconfig/ftpTest
local_root=/var/ftp/ftpTest

創(chuàng)建目錄

[root@~]# mkdir -p /var/ftp/ftpTest
[root@~]# touch /var/ftp/ftpTest/test

重啟 vsftp.service 服務(wù)

[rppt@~]# systemctl restart vsftpd.service

登錄測(cè)試

[root@~]# ftp localhost
Trying 127.0.0.1...
Connected to localhost (127.0.0.1).
220-
220-歡迎光臨 Deepppixel 網(wǎng)站!本站提供 FTP 服務(wù)择克!
220-如有問題請(qǐng)聯(lián)系 Deepppixel !
220-
220 
Name (localhost:root): ftpTest
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> dir
227 Entering Passive Mode (127,0,0,1,178,26).
150 Here comes the directory listing.
-rw-r--r--    1 0        0               0 Sep 19 18:39 test
226 Directory send OK.
ftp> bye
221 Goodbye.

刪除測(cè)試用戶 ftpTest恬总,及相關(guān)文件

[root@~]# userdel -r ftpTest

[root@~]# rm -rf /var/ftp/ftpTest

[root@~]# rm /etc/vsftpd/userconfig/ftpTest

移除 chroot_list 的 ftpTest

[root@~]# vim /etc/vsftpd/chroot_list

重啟 vsftp.service 服務(wù)

[rppt@~]# systemctl restart vsftpd.service

Step 07

其他配置

限制帶寬

[root@~]# vim /etc/vsftpd/vsftpd.conf
local_max_rate=1000000  // 單位是 bytes/second

local_max_rate // The maximum data transfer rate permitted, in bytes per second, for local authenticated users.

限制同時(shí)在線人數(shù),及單個(gè) ip 的聯(lián)機(jī)數(shù)

max_clients=10
max_per_ip=1

關(guān)閉 userlist_deny肚邢,開啟嚴(yán)格的用戶登錄功能

userlist_deny=YES -- 修改成 --> userlist_deny=NO

關(guān)閉匿名登錄

anonymous_enable=YES -- 修改成 --> anonymous_enable=NO

如果想使用匿名用戶登錄壹堰,可以詳細(xì)看看鳥哥的文章。

重啟 vsftp.service 服務(wù)

[rppt@~]# systemctl restart vsftpd.service

Step 08

打開防火墻

[root@~]# firewall-cmd --permanent --zone=public --add-service=ftp
[root@~]# firewall-cmd --reload

重啟 vsftp.service 服務(wù)

[rppt@~]# systemctl restart vsftpd.service

Step 09

配置 WordPress FTP

先創(chuàng)建供 WordPress 使用的用戶

[root@~]# useradd deepppixelAdmin

[root@~]# passwd deepppixelAdmin

把 deepppixelAdmin 添加進(jìn) chroot_list

[root@~]# vim /etc/vsftpd/chroot_list
deepppixelAdmin

添加根目錄

[root@~]# vim /etc/vsftpd/userconfig/deepppixel_com
local_root=/var/ftp/deepppixel.com/

創(chuàng)建根目錄

[root@~]# mkdir -p /var/ftp/deepppixel.com

重啟 vsftp.service 服務(wù)

[rppt@~]# systemctl restart vsftpd.service

登錄測(cè)試

[root@~]# ftp localhost
Trying 127.0.0.1...
Connected to localhost (127.0.0.1).
220-
220-歡迎光臨 Deepppixel 網(wǎng)站骡湖!本站提供 FTP 服務(wù)贱纠!
220-如有問題請(qǐng)聯(lián)系 Deepppixel !
220-
220 
Name (localhost:root): deepppixelAdmin
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> bye
221 GoodBye

配置 WordPress 的 wp-config.php 文件

[root@~]# vim /var/www/deepppixel.com/wp-config.php
/* FTP */
define( 'FTP_USER', '名稱' );
define( 'FTP_PASS', '密碼' );
define( 'FTP_SSL', true ); // 開啟加密傳輸

重啟 Apache

[root@~]# systmctl restart httpd.service

安裝 Samba 服務(wù) (可選)

鳥哥 Samba 鏈接:http://cn.linux.vbird.org/linux_server/0370samba_1.php

鳥哥的 Linux 私房菜 -- 服務(wù)器架設(shè)篇目錄 Samba

Samba , Samba 文檔

開始安裝 Samba 服務(wù)

查看 yum 上的版本

[root@~]# yum list | grep "samba\."  
kdenetwork-fileshare-samba.x86_64          7:4.10.5-8.el7_0           base      
pcp-pmda-samba.x86_64                      3.12.2-5.el7               base      
php-pear-Auth-samba.noarch                 1.6.4-2.el7                epel 
samba.x86_64                               4.7.1-9.el7_5              updates   

安裝 Samba

[root@~]# yum -y install samba

查看安裝好的 Samba

[root@~]# yum list installed | grep "samba"  

結(jié)語:由于我的服務(wù)器需要安裝 Swift Perfect ,但是 Swift 只支持 MacOS 和 Ubuntu 响蕴,沒有辦法只能放棄 CentOS 短暫且愉快的一次冒險(xiǎn)谆焊,Samba 的配置也就不寫了。

后面要更新的文章浦夷,《阿里云 ECS 服務(wù)器 Ubuntu 搭建 LAMP WordPress 環(huán)境》 以及 《阿里云 ECS 服務(wù)器 Ubuntu 搭建 Swift Perfect》我們江湖再見 辖试。

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
  • 序言:七十年代末辜王,一起剝皮案震驚了整個(gè)濱河市,隨后出現(xiàn)的幾起案子罐孝,更是在濱河造成了極大的恐慌呐馆,老刑警劉巖,帶你破解...
    沈念sama閱讀 218,858評(píng)論 6 508
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件莲兢,死亡現(xiàn)場(chǎng)離奇詭異汹来,居然都是意外死亡,警方通過查閱死者的電腦和手機(jī)怒见,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 93,372評(píng)論 3 395
  • 文/潘曉璐 我一進(jìn)店門俗慈,熙熙樓的掌柜王于貴愁眉苦臉地迎上來,“玉大人遣耍,你說我怎么就攤上這事闺阱。” “怎么了舵变?”我有些...
    開封第一講書人閱讀 165,282評(píng)論 0 356
  • 文/不壞的土叔 我叫張陵酣溃,是天一觀的道長(zhǎng)。 經(jīng)常有香客問我纪隙,道長(zhǎng)赊豌,這世上最難降的妖魔是什么? 我笑而不...
    開封第一講書人閱讀 58,842評(píng)論 1 295
  • 正文 為了忘掉前任绵咱,我火速辦了婚禮碘饼,結(jié)果婚禮上,老公的妹妹穿的比我還像新娘悲伶。我一直安慰自己艾恼,他們只是感情好,可當(dāng)我...
    茶點(diǎn)故事閱讀 67,857評(píng)論 6 392
  • 文/花漫 我一把揭開白布麸锉。 她就那樣靜靜地躺著钠绍,像睡著了一般。 火紅的嫁衣襯著肌膚如雪花沉。 梳的紋絲不亂的頭發(fā)上柳爽,一...
    開封第一講書人閱讀 51,679評(píng)論 1 305
  • 那天,我揣著相機(jī)與錄音碱屁,去河邊找鬼磷脯。 笑死,一個(gè)胖子當(dāng)著我的面吹牛忽媒,可吹牛的內(nèi)容都是我干的争拐。 我是一名探鬼主播,決...
    沈念sama閱讀 40,406評(píng)論 3 418
  • 文/蒼蘭香墨 我猛地睜開眼,長(zhǎng)吁一口氣:“原來是場(chǎng)噩夢(mèng)啊……” “哼架曹!你這毒婦竟也來了隘冲?” 一聲冷哼從身側(cè)響起,我...
    開封第一講書人閱讀 39,311評(píng)論 0 276
  • 序言:老撾萬榮一對(duì)情侶失蹤绑雄,失蹤者是張志新(化名)和其女友劉穎展辞,沒想到半個(gè)月后,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體万牺,經(jīng)...
    沈念sama閱讀 45,767評(píng)論 1 315
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡罗珍,尸身上長(zhǎng)有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 37,945評(píng)論 3 336
  • 正文 我和宋清朗相戀三年,在試婚紗的時(shí)候發(fā)現(xiàn)自己被綠了脚粟。 大學(xué)時(shí)的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片覆旱。...
    茶點(diǎn)故事閱讀 40,090評(píng)論 1 350
  • 序言:一個(gè)原本活蹦亂跳的男人離奇死亡,死狀恐怖核无,靈堂內(nèi)的尸體忽然破棺而出扣唱,到底是詐尸還是另有隱情,我是刑警寧澤团南,帶...
    沈念sama閱讀 35,785評(píng)論 5 346
  • 正文 年R本政府宣布噪沙,位于F島的核電站,受9級(jí)特大地震影響吐根,放射性物質(zhì)發(fā)生泄漏正歼。R本人自食惡果不足惜,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 41,420評(píng)論 3 331
  • 文/蒙蒙 一拷橘、第九天 我趴在偏房一處隱蔽的房頂上張望局义。 院中可真熱鬧,春花似錦冗疮、人聲如沸旭咽。這莊子的主人今日做“春日...
    開封第一講書人閱讀 31,988評(píng)論 0 22
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽。三九已至轿塔,卻和暖如春特愿,著一層夾襖步出監(jiān)牢的瞬間,已是汗流浹背勾缭。 一陣腳步聲響...
    開封第一講書人閱讀 33,101評(píng)論 1 271
  • 我被黑心中介騙來泰國(guó)打工揍障, 沒想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留,地道東北人俩由。 一個(gè)月前我還...
    沈念sama閱讀 48,298評(píng)論 3 372
  • 正文 我出身青樓毒嫡,卻偏偏與公主長(zhǎng)得像,于是被迫代替她去往敵國(guó)和親幻梯。 傳聞我的和親對(duì)象是個(gè)殘疾皇子兜畸,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 45,033評(píng)論 2 355

推薦閱讀更多精彩內(nèi)容

  • ftp 文件傳輸協(xié)議 跨平臺(tái) 上傳下載文件 vsftpd 工具:非常安全的文件傳輸協(xié)議努释;默認(rèn)的命令端口21號(hào),數(shù)據(jù)...
    柒夏錦閱讀 4,030評(píng)論 1 9
  • BOOLEAN OPTIONS Below is a list of boolean options. The v...
    usrbin閱讀 1,718評(píng)論 0 0
  • FTP服務(wù)概述 簡(jiǎn)單FTP構(gòu)建及訪問 VSFTP服務(wù)基礎(chǔ) 用戶禁錮咬摇、黑白名單 FTP并發(fā)及帶寬限制 一伐蒂、FTP服務(wù)...
    紫_軒閱讀 7,611評(píng)論 3 25
  • 1 概述 工作中,需要搭建ftp服務(wù)器來實(shí)現(xiàn)資源的共享肛鹏。本文將通過腳本實(shí)現(xiàn)自動(dòng)化安裝ftp服務(wù)器逸邦,并進(jìn)行相關(guān)配置,...
    ghbsunny閱讀 3,099評(píng)論 0 2
  • 干旱 把春天的腳步無限延長(zhǎng) 小滿了 那滿目瘡痍的田野 還沒有穿上衣裳 更沒有鳥鳴 樹林 也一副無可奈何的模樣 太陽...
    半盞流年02閱讀 297評(píng)論 0 1