三含衔、搭建共享文件服務(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
開始安裝 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
開始安裝 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》我們江湖再見 辖试。