一、前言介紹
FTP(文件傳輸協議)是一種標准的客戶機-服務器網絡協議,允許用戶在遠程網絡之間傳輸文件。
有幾個開源的FTP服務器可用於Linux。最受歡迎和廣泛使用的是pureftpd、proftpd和vsftpd。
在本教程中,我們將在Centos7上安裝vsftpd(非常安全的ftp守護進程)。它是一個穩定、安全和快速的FTP服務器。我們還將向您展示如何配置vsftpd,以將用戶限制到其主目錄,並使用ssl/tls加密整個傳輸。
要獲得更安全和更快的數據傳輸,請使用SCP或SFTP。
二、先決條件
在繼續本教程之前,請確保您以具有sudo權限的用戶身份登錄。(root 登錄可以不用sudo 一般可以省略sudo )
sudo的工作過程如下:
1,當用戶執行sudo時,系統會主動尋找/etc/sudoers文件,判斷該用戶是否有執行sudo的權限
2,確認用戶具有可執行sudo的權限后,讓用戶輸入用戶自己的密碼確認
3,若密碼輸入成功,則開始執行sudo后續的命令
4,root執行sudo時不需要輸入密碼(eudoers文件中有配置root ALL=(ALL) ALL這樣一條規則)
5,若欲切換的身份與執行者的身份相同,也不需要輸入密碼
visudo使用vi打開/etc/sudoers文件,但是在保存退出時,visudo會檢查內部語法,避免用戶輸入錯誤信息
visudo需要root權限
[hadoop@localhost ~]$ visudo
visudo:/etc/sudoers:權限不夠
visudo:/etc/sudoers:權限不夠
三、在CentOS 7上安裝vsftpd
1、vsftpd包在默認的CentOS存儲庫中可用。要安裝它,請發出以下命令:
sudo yum install vsftpd
2、安裝包后,啟動vsftpd守護進程並使其在啟動時自動啟動,vsftpd服務的狀態來驗證它是否正在運行
#設置開機啟動
systemctl enable vsftpd.service
#啟動
systemctl start vsftpd.service
#停止
systemctl stop vsftpd.service
#查看狀態
systemctl status vsftpd.service
#重啟
systemctl restart vsftpd.service
具體操作如下,操作完成之后都要重啟啟動並且查看狀態的
[root@centos001 ~]# sudo yum install vsftpd Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile base | 3.6 kB 00:00:00 epel | 4.7 kB 00:00:00 extras | 3.4 kB 00:00:00 packages-microsoft-com-prod | 2.9 kB 00:00:00 updates | 3.4 kB 00:00:00 Resolving Dependencies --> Running transaction check ---> Package vsftpd.x86_64 0:3.0.2-25.el7 will be installed --> Finished Dependency Resolution Dependencies Resolved =============================================================================================================================================== Package Arch Version Repository Size =============================================================================================================================================== Installing: vsftpd x86_64 3.0.2-25.el7 base 171 k Transaction Summary =============================================================================================================================================== Install 1 Package Total download size: 171 k Installed size: 353 k Is this ok [y/d/N]: y Downloading packages: vsftpd-3.0.2-25.el7.x86_64.rpm | 171 kB 00:00:00 Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : vsftpd-3.0.2-25.el7.x86_64 1/1 Verifying : vsftpd-3.0.2-25.el7.x86_64 1/1 Installed: vsftpd.x86_64 0:3.0.2-25.el7 Complete! [root@centos001 ~]# sudo systemctl start vsftpd [root@centos001 ~]# sudo systemctl enable vsftpd Created symlink from /etc/systemd/system/multi-user.target.wants/vsftpd.service to /usr/lib/systemd/system/vsftpd.service. [root@centos001 ~]# sudo systemctl enable vsftpd [root@centos001 ~]# systemctl status vsftpd ● vsftpd.service - Vsftpd ftp daemon Loaded: loaded (/usr/lib/systemd/system/vsftpd.service; enabled; vendor preset: disabled) Active: active (running) since Wed 2019-05-08 22:48:51 CST; 48s ago Main PID: 9652 (vsftpd) CGroup: /system.slice/vsftpd.service └─9652 /usr/sbin/vsftpd /etc/vsftpd/vsftpd.conf May 08 22:48:51 centos001 systemd[1]: Starting Vsftpd ftp daemon... May 08 22:48:51 centos001 systemd[1]: Started Vsftpd ftp daemon. [root@centos001 ~]#
四、配置vsftpd(重點標記,我自己錯誤了好多次才成功的,錯了就刪除了重新配置)
配置vsftpd服務涉及編輯/etc/vsftpd/vsftpd.conf配置文件。大多數設置都在配置文件中有很好的文檔記錄。有關所有可用選項,請訪問官方vsftpd頁面。 http://vsftpd.beasts.org/vsftpd_conf.html(官方介紹,比較好用,英文不好的戳這里:https://www.cnblogs.com/sopcce/p/10743359.html)
在下面的部分中,我們將介紹配置安全vsftpd安裝所需的一些重要設置。
1、首先打開vsftpd配置文件:
vi /etc/vsftpd/vsftpd.conf
2、編輯配置文件( 配置文件 /etc/vsftpd/vsftpd.conf,修改:wq )
anonymous_enable=N0 xferlog_file=/var/log/xferlog xferlog_std_format=YES ftpd_banner=Welcome to blah FTP service.
userlist_file=/etc/vsftpd/user_list userlist_deny=YES user_sub_token=$USER local_root=/home/$USER/ftp pasv_min_port=30000 pasv_max_port=31000
原來的配置文件如下,記得備份文件哦
[root@centos-7-06-64-20G ~]# vi /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. # # Allow anonymous FTP? (Beware - allowed by default if you comment this out). anonymous_enable=YES # # Uncomment this to allow local users to log in. # When SELinux is enforcing check for SE bool ftp_home_dir local_enable=YES # # Uncomment this to enable any form of FTP write command. write_enable=YES # # Default umask for local users is 077. You may wish to change this to 022, # if your users expect that (022 is used by most other ftpd's) local_umask=022 # # Uncomment this to allow the anonymous FTP user to upload files. This only # has an effect if the above global write enable is activated. Also, you will # obviously need to create a directory writable by the FTP user. # When SELinux is enforcing check for SE bool allow_ftpd_anon_write, allow_ftpd_full_access #anon_upload_enable=YES # # Uncomment this if you want the anonymous FTP user to be able to create # new directories. #anon_mkdir_write_enable=YES # # Activate directory messages - messages given to remote users when they # go into a certain directory. dirmessage_enable=YES # # Activate logging of uploads/downloads. xferlog_enable=YES # # Make sure PORT transfer connections originate from port 20 (ftp-data). connect_from_port_20=YES # # If you want, you can arrange for uploaded anonymous files to be owned by # a different user. Note! Using "root" for uploaded files is not # recommended! #chown_uploads=YES #chown_username=whoever # # You may override where the log file goes if you like. The default is shown # below. #xferlog_file=/var/log/xferlog # # If you want, you can have your log file in standard ftpd xferlog format. # Note that the default log file location is /var/log/xferlog in this case. #nopriv_user=ftpsecure # # Enable this and the server will recognise asynchronous ABOR requests. Not # recommended for security (the code is non-trivial). Not enabling it, # however, may confuse older FTP clients. #async_abor_enable=YES # If you want, you can arrange for uploaded anonymous files to be owned by # a different user. Note! Using "root" for uploaded files is not # recommended! #chown_uploads=YES #chown_username=whoever # # You may override where the log file goes if you like. The default is shown # below. #xferlog_file=/var/log/xferlog # # If you want, you can have your log file in standard ftpd xferlog format. # Note that the default log file location is /var/log/xferlog in this case. xferlog_std_format=YES # # You may change the default value for timing out an idle session. #idle_session_timeout=600 # # You may change the default value for timing out a data connection. #data_connection_timeout=120 # # It is recommended that you define on your system a unique user which the # ftp server can use as a totally isolated and unprivileged user. #nopriv_user=ftpsecure # # Enable this and the server will recognise asynchronous ABOR requests. Not # recommended for security (the code is non-trivial). Not enabling it, # however, may confuse older FTP clients. #async_abor_enable=YES # # By default the server will pretend to allow ASCII mode but in fact ignore # the request. Turn on the below options to have the server actually do ASCII # mangling on files when in ASCII mode. The vsftpd.conf(5) man page explains # the behaviour when these options are disabled. # Beware that on some FTP servers, ASCII support allows a denial of service # attack (DoS) via the command "SIZE /big/file" in ASCII mode. vsftpd # predicted this attack and has always been safe, reporting the size of the # raw file. # ASCII mangling is a horrible feature of the protocol. #ascii_upload_enable=YES #ascii_download_enable=YES # # You may fully customise the login banner string: #ftpd_banner=Welcome to blah FTP service. # # You may specify a file of disallowed anonymous e-mail addresses. Apparently # useful for combatting certain DoS attacks. #deny_email_enable=YES # (default follows) #banned_email_file=/etc/vsftpd/banned_emails # # You may specify an explicit list of local users to chroot() to their home # obviously need to create a directory writable by the FTP user. # When SELinux is enforcing check for SE bool allow_ftpd_anon_write, allow_ftpd_full_access #anon_upload_enable=YES # # Uncomment this if you want the anonymous FTP user to be able to create # new directories. #anon_mkdir_write_enable=YES # # Activate directory messages - messages given to remote users when they # go into a certain directory. dirmessage_enable=YES # # Activate logging of uploads/downloads. xferlog_enable=YES # # Make sure PORT transfer connections originate from port 20 (ftp-data). connect_from_port_20=YES # # If you want, you can arrange for uploaded anonymous files to be owned by # a different user. Note! Using "root" for uploaded files is not # recommended! #chown_uploads=YES #chown_username=whoever # # You may override where the log file goes if you like. The default is shown # below. #xferlog_file=/var/log/xferlog # # If you want, you can have your log file in standard ftpd xferlog format. # Note that the default log file location is /var/log/xferlog in this case. xferlog_std_format=YES # # You may change the default value for timing out an idle session. #idle_session_timeout=600 # # You may change the default value for timing out a data connection. #data_connection_timeout=120 # # It is recommended that you define on your system a unique user which the # ftp server can use as a totally isolated and unprivileged user. #nopriv_user=ftpsecure # # Enable this and the server will recognise asynchronous ABOR requests. Not # recommended for security (the code is non-trivial). Not enabling it, # however, may confuse older FTP clients. #async_abor_enable=YES # # By default the server will pretend to allow ASCII mode but in fact ignore # the request. Turn on the below options to have the server actually do ASCII # mangling on files when in ASCII mode. The vsftpd.conf(5) man page explains # the behaviour when these options are disabled. # Beware that on some FTP servers, ASCII support allows a denial of service # attack (DoS) via the command "SIZE /big/file" in ASCII mode. vsftpd # predicted this attack and has always been safe, reporting the size of the # raw file. # ASCII mangling is a horrible feature of the protocol. #ascii_upload_enable=YES #ascii_download_enable=YES # # You may fully customise the login banner string: #ftpd_banner=Welcome to blah FTP service. # # You may specify a file of disallowed anonymous e-mail addresses. Apparently # directory. If chroot_local_user is YES, then this list becomes a list of # users to NOT chroot(). # (Warning! chroot'ing can be very dangerous. If using chroot, make sure that # the user does not have write access to the top level directory within the # chroot) #chroot_local_user=YES #chroot_list_enable=YES # (default follows) #chroot_list_file=/etc/vsftpd/chroot_list # # You may activate the "-R" option to the builtin ls. This is disabled by # default to avoid remote users being able to cause excessive I/O on large # sites. However, some broken FTP clients such as "ncftp" and "mirror" assume # the presence of the "-R" option, so there is a strong case for enabling it. #ls_recurse_enable=YES # # When "listen" directive is enabled, vsftpd runs in standalone mode and # listens on IPv4 sockets. This directive cannot be used in conjunction # with the listen_ipv6 directive. listen=NO # # This directive enables listening on IPv6 sockets. By default, listening # on the IPv6 "any" address (::) will accept connections from both IPv6 # and IPv4 clients. It is not necessary to listen on *both* IPv4 and IPv6 # sockets. If you want that (perhaps because you want to listen on specific # addresses) then you must run two copies of vsftpd with two configuration # files. # Make sure, that one of the listen options is commented !! listen_ipv6=YES pam_service_name=vsftpd userlist_enable=YES tcp_wrappers=YES
注意:配置完成之后,(重啟)服務,如果服務異常,請輸入(查看狀態命令)服務,服務具體錯誤有提示。
例如下圖,錯誤提示信息給出來了,你查看錯誤發現你輸入的信息也對,為啥有這個提示,
請相信你的PC,你輸入有問題,看下你的空格,空格,空格
我的配置文件
[root@centos-7-06-64-20G ~]# vi /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. # # Allow anonymous FTP? (Beware - allowed by default if you comment this out). #anonymous_enable=YES anonymous_enable=NO # # Uncomment this to allow local users to log in. # When SELinux is enforcing check for SE bool ftp_home_dir local_enable=YES # # Uncomment this to enable any form of FTP write command. write_enable=YES # # Default umask for local users is 077. You may wish to change this to 022, # if your users expect that (022 is used by most other ftpd's) local_umask=022 # # Uncomment this to allow the anonymous FTP user to upload files. This only # has an effect if the above global write enable is activated. Also, you will # obviously need to create a directory writable by the FTP user. # When SELinux is enforcing check for SE bool allow_ftpd_anon_write, allow_ftpd_full_access #anon_upload_enable=YES # # Uncomment this if you want the anonymous FTP user to be able to create # new directories. #anon_mkdir_write_enable=YES # # Activate directory messages - messages given to remote users when they # go into a certain directory. dirmessage_enable=YES # # Activate logging of uploads/downloads. xferlog_enable=YES # # Make sure PORT transfer connections originate from port 20 (ftp-data). connect_from_port_20=YES # # If you want, you can arrange for uploaded anonymous files to be owned by # a different user. Note! Using "root" for uploaded files is not # recommended! #chown_uploads=YES #chown_username=whoever # # You may override where the log file goes if you like. The default is shown # below. #xferlog_file=/var/log/xferlog xferlog_file=/var/log/xferlog # # If you want, you can have your log file in standard ftpd xferlog format. # Note that the default log file location is /var/log/xferlog in this case. xferlog_std_format=YES # # You may change the default value for timing out an idle session. #idle_session_timeout=600 # # You may change the default value for timing out a data connection. #data_connection_timeout=120 # # It is recommended that you define on your system a unique user which the # ftp server can use as a totally isolated and unprivileged user. #nopriv_user=ftpsecure # # Enable this and the server will recognise asynchronous ABOR requests. Not # recommended for security (the code is non-trivial). Not enabling it, # however, may confuse older FTP clients. #async_abor_enable=YES # # By default the server will pretend to allow ASCII mode but in fact ignore # the request. Turn on the below options to have the server actually do ASCII # mangling on files when in ASCII mode. The vsftpd.conf(5) man page explains # the behaviour when these options are disabled. # Beware that on some FTP servers, ASCII support allows a denial of service # attack (DoS) via the command "SIZE /big/file" in ASCII mode. vsftpd # predicted this attack and has always been safe, reporting the size of the # raw file. # ASCII mangling is a horrible feature of the protocol. #ascii_upload_enable=YES #ascii_download_enable=YES # # You may fully customise the login banner string: #ftpd_banner=Welcome to blah FTP service. ftpd_banner=sopcce.com welcome to ftp service, # # You may specify a file of disallowed anonymous e-mail addresses. Apparently # useful for combatting certain DoS attacks. #deny_email_enable=YES # (default follows) #banned_email_file=/etc/vsftpd/banned_emails # # You may specify an explicit list of local users to chroot() to their home # directory. If chroot_local_user is YES, then this list becomes a list of # users to NOT chroot(). # (Warning! chroot'ing can be very dangerous. If using chroot, make sure that # the user does not have write access to the top level directory within the # chroot) chroot_local_user=YES #chroot_list_enable=YES # (default follows) #chroot_list_file=/etc/vsftpd/chroot_list # # You may activate the "-R" option to the builtin ls. This is disabled by # default to avoid remote users being able to cause excessive I/O on large # sites. However, some broken FTP clients such as "ncftp" and "mirror" assume # the presence of the "-R" option, so there is a strong case for enabling it. #ls_recurse_enable=YES # # When "listen" directive is enabled, vsftpd runs in standalone mode and # listens on IPv4 sockets. This directive cannot be used in conjunction # with the listen_ipv6 directive. listen=NO # # This directive enables listening on IPv6 sockets. By default, listening # on the IPv6 "any" address (::) will accept connections from both IPv6 # and IPv4 clients. It is not necessary to listen on *both* IPv4 and IPv6 # sockets. If you want that (perhaps because you want to listen on specific # addresses) then you must run two copies of vsftpd with two configuration # files. # Make sure, that one of the listen options is commented !! listen_ipv6=YES pam_service_name=vsftpd userlist_enable=YES tcp_wrappers=YES #ADD 201900509 userlist_file=/etc/vsftpd/user_list userlist_deny=YES user_sub_token=$USER local_root=/ allow_writeable_chroot=YES pasv_min_port=30000 pasv_max_port=31000
3、設置root 賬號登錄權限
編輯一下文件,重啟服務查看狀態。
vi /etc/vsftpd/ftpusers 注釋掉 #root vi /etc/vsftpd/user_list 注釋掉 #root vi /etc/vsftpd/vsftpd.conf write_enable=YES
具體操作如下
[root@centos001 ~]# cd /etc/vsftpd [root@centos001 vsftpd]# ls ftpusers user_list vsftpd.conf vsftpd_conf_migrate.sh [root@centos001 vsftpd]# vi user_list
[root@centos001 vsftpd]# vi ftpusers
[root@centos001 vsftpd]# systemctl restart vsftpd.service
[root@centos001 vsftpd]# 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 Thu 2019-05-09 00:08:15 CST; 7s ago Process: 10007 ExecStart=/usr/sbin/vsftpd /etc/vsftpd/vsftpd.conf (code=exited, status=0/SUCCESS) Main PID: 10008 (vsftpd) CGroup: /system.slice/vsftpd.service └─10008 /usr/sbin/vsftpd /etc/vsftpd/vsftpd.conf May 09 00:08:15 centos001 systemd[1]: Stopping Vsftpd ftp daemon... May 09 00:08:15 centos001 systemd[1]: Stopped Vsftpd ftp daemon. May 09 00:08:15 centos001 systemd[1]: Starting Vsftpd ftp daemon... May 09 00:08:15 centos001 systemd[1]: Started Vsftpd ftp daemon. [root@centos001 vsftpd]#
4、安裝FTP,測試
輸入、
yum install ftp
具體操作如下
[root@centos-7-06-64-20G ~]# yum install ftp Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile Resolving Dependencies --> Running transaction check ---> Package ftp.x86_64 0:0.17-67.el7 will be installed --> Finished Dependency Resolution Dependencies Resolved =============================================================================================================================================== Package Arch Version Repository Size =============================================================================================================================================== Installing: ftp x86_64 0.17-67.el7 base 61 k Transaction Summary =============================================================================================================================================== Install 1 Package Total download size: 61 k Installed size: 96 k Is this ok [y/d/N]: y 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! [root@centos-7-06-64-20G ~]#
測試本地FTP
[root@centos-7-06-64-20G ~]# ftp ftp> open 127.0.0.1 Connected to 127.0.0.1 (127.0.0.1). 220 welcome to 39...120 ftp vsftpd server. Name (127.0.0.1:root): root 530 Permission denied. Login failed. ftp> quit 221 Goodbye.
五、配置vsftpd 創建FTP用戶
為了測試我們的FTP服務器,我們將創建一個新用戶。
如果您已經擁有要授予FTP訪問權限的用戶,請跳過第1步。
如果在配置文件中設置allow_writeable_chroot = YES,請跳過第3步。
創建一個名為sopftpuser的新用戶:
1、創建一個名為sopftpuser的新用戶,接下來,設置用戶密碼
sudo adduser sopftpuser
sudo passwd sopftpuser
2、將用戶添加到允許的FTP用戶列表中
echo "sopftpuser" | sudo tee -a /etc/vsftpd/user_list
3、創建FTP目錄樹並設置正確的權限
sudo mkdir -p /home/sopftpuser/ftp/ sudo chmod 550 /home/sopftpuser/ftp sudo chmod 750 /home/sopftpuser/ftp/ sudo chown -R sopftpuser: /home/sopftpuser/ftp
如上一節所述,用戶可以將其文件上傳到ftp / upload目錄。
此時,您的FTP服務器功能齊全,您應該可以使用任何可配置為使用TLS加密的FTP客戶端(如FileZilla)連接到您的服務器
[root@centos001 ~]# sudo adduser sopftpuser [root@centos001 ~]# sudo passwd sopftpuser Changing password for user sopftpuser. New password: BAD PASSWORD: The password is shorter than 8 characters Retype new password: Sorry, passwords do not match. New password: BAD PASSWORD: The password fails the dictionary check - it does not contain enough DIFFERENT characters Retype new password: passwd: all authentication tokens updated successfully. [root@centos001 ~]# echo "sopftpuser" | sudo tee -a /etc/vsftpd/user_list sopftpuser [root@centos001 ~]# sudo mkdir -p /home/sopftpuser/ftp/ [root@centos001 ~]# sudo chmod 550 /home/sopftpuser/ftp [root@centos001 ~]# sudo chmod 750 /home/sopftpuser/ftp/upload chmod: cannot access ‘/home/sopftpuser/ftp/upload’: No such file or directory [root@centos001 ~]# sudo chmod 750 /home/sopftpuser/ftp [root@centos001 ~]# sudo chown -R sopftpuser: /home/sopftpuser/ftp [root@centos001 ~]#
六、卸載(出錯了,你就卸載了在重新安裝,或者修改你的配置文件,此操作我做了多次,畢竟是萌新)
如果服務器上安裝了vsftpd,配置出錯需要卸載vsftpd
rpm -aq vsftpd
卸載vsftpd
rpm -e vsftpd-3.0.3
#用rpm -e 查找結果 進行刪除就ok了。
warning: /etc/vsftpd/user_list saved as /etc/vsftpd/user_list.rpmsave warning: /etc/vsftpd/ftpusers saved as /etc/vsftpd/ftpusers.rpmsave #刪除時將備份vsftp的用戶列表文件。
七、結論
您學習了如何在CentOS 7系統上安裝和配置安全,輸入用戶名和密碼,登錄FTP。
八、相關資料
》查看https://linuxize.com/post/how-to-setup-ftp-server-with-vsftpd-on-centos-7/,本文大部分是參看它的介紹,
但是在此基礎上做了增加,但是其中遇到了很多的坑,哎
》查看https://www.cnblogs.com/sopcce/p/10743359.html 本文介紹了配置文件,
包括特別多,對ftp 訪問的授權,訪問的目錄等,還在慢慢看中
解決:
setenforce: SELinux is disabled
那么說明selinux已經被徹底的關閉了
如果需要重新開啟selinux,請按下面步驟:
vi /etc/selinux/config
更改為:SELINUX=1
必須重啟linux,不重啟是沒辦法立刻開啟selinux的
關閉
1 命令查看出selinux的狀態
sestatus -v
2 臨時關閉 selinux
setenforce 0
3 永久關閉selinux
vi /etc/sysconfig/selinux
把里邊的一行改為
SELINUX=disabled
setenforce 1 設置SELinux 成為enforcing模式
setenforce 0 設置SELinux 成為permissive模式
如果要徹底禁用SELinux 需要在/etc/sysconfig/selinux中設置參數selinux=0
更新日期:2019-04-21
vi