centos 關閉FireWall 和SELinux的方法,centosselinux

來源:互聯網
上載者:User

centos 關閉FireWall 和SELinux的方法,centosselinux
1. 環境

centos-7.x 選擇最完整版安裝(workstation選項) VMware Workstation 10.0.0

2. 關閉FireWall和SELinux2.1 FireWall

使用systemctl status firewalld查看防火牆的狀態,如下(預設開啟)

[root@localhost ~]# systemctl status firewalld // 防火牆狀態● firewalld.service - firewalld - dynamic firewall daemon   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled)   Active: active (running) since 三 2018-03-28 07:07:33 CST; 7h left     Docs: man:firewalld(1) Main PID: 1055 (firewalld)   CGroup: /system.slice/firewalld.service           └─1055 /usr/bin/python -Es /usr/sbin/firewalld --nofork --nopid..........

如果你需要使用FireWall服務(正式環境下),則需要修改它的配置,因為在預設情況下,它會攔截大多數服務要求。具體可以參考配置firewalld服務的基本操作和設定。

如果由於某些原因(比如博主只是需要linux伺服器來搭建某些服務,不想控制防火牆只開放某些連接埠)等而不需要FireWall服務,則可以像下面那樣停止並禁用它。

// 關閉服務[root@localhost ~]# systemctl stop firewalld// 關閉開機自動開啟FireWall服務[root@localhost ~]# systemctl disable firewalld Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
2.2 關閉SELinux

可以用getenforce 查看SELinux的狀態,如下(預設開啟)

[root@localhost ~]# getenforce//開啟狀態Enforcing 

同上,如果你想使用SELinux也可以。但是博主不想那麼麻煩,所以把SELinux也關閉了。

[root@localhost ~]# vi /etc/selinux/config# This file controls the state of SELinux on the system.# SELINUX= can take one of these three values:#     enforcing - SELinux security policy is enforced.#     permissive - SELinux prints warnings instead of enforcing.#     disabled - No SELinux policy is loaded.// 這裡改變為disabledSELINUX=disabled# SELINUXTYPE= can take one of three two values:#     targeted - Targeted processes are protected,#     minimum - Modification of targeted policy. Only selected processes are protected.#     mls - Multi Level Security protection.SELINUXTYPE=targeted// 重啟使配置生效[root@localhost ~]# reboot
3. 錯誤集錦

切換成root使用者操作

聯繫我們

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