1. 程式人生 > >Linux基礎優化之SElinux和iptables項

Linux基礎優化之SElinux和iptables項

linux基礎優化

版權聲明:
###########################################################################
本文的所有內容均來自作者劉春凱的學習總結,未經本人許可,禁止私自轉發及使用。
QQ:1151887353
E-mail:[email protected]      [email protected]
[email protected]#########
第1章 關閉SElinux的方法
1.1 操作前備份
法一:
[[email protected] ~]# cp/etc/selinux/config /etc/selinux/config.bak
[[email protected]
/* */ ~]# ls /etc/selinux config config.bak restorecond.conf restorecond_user.conf semanage.conf targeted 法二: [[email protected] ~]# sed -i.ori‘s#SELINUX=enforcing#SELINUX=disabled#g‘ /etc/selinux/config===-i.ori替換前備份文件; [[email protected] ~]# ls /etc/selinux config config.bak config.ori restorecond.conf restorecond_user.conf semanage.conf targeted 1.2 永久關閉SElinux(修改配置文件) [[email protected]
/* */ ~]# cat /etc/selinux/config # This file controls the state of SELinux on thesystem. # 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. SELINUX=enforcing # SELINUXTYPE= can take one of these two values: # targeted - Targeted processes are protected, # mls -Multi Level Security protection. SELINUXTYPE=targeted [[email protected]
/* */ ~]# sed -i ‘s#SELINUX=enforcing#SELINUX=disabled#g‘/etc/selinux/config [[email protected] ~]# cat /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. SELINUX=disabled # SELINUXTYPE= can take one of these two values: # targeted - Targeted processes are protected, # mls -Multi Level Security protection. SELINUXTYPE=targeted ===需要重啟服務器才能生效(工作場景中不要以任何理由重啟服務器); 1.3 臨時關閉 [[email protected] ~]# getenforce ===查看selinux狀態 Enforcing [[email protected] ~]# setenforce ===查看selinux設置選項 usage: setenforce [ Enforcing | Permissive | 1 | 0 ]===1:開啟;0:提醒但不阻止; [[email protected] ~]# setenforce 0===設置為0 [[email protected] ~]# getenforce Permissive 1.4 恢復SElinux的方法 法一:命令行恢復 setenforce 1; 法二:文件回復 1、通過vi、sed直接修改配置文件 2、mv/etc/selinux/config.bak /etc/selinux/config==直接覆蓋配置文件 第2章 關閉防火墻iptables 2.1 臨時關閉iptables 查看防火墻狀態 法一: /etc/init.d/iptables status 法二: service iptables status 臨時關閉防火墻 法一: /etc/init.d/iptables stop /etc/init.d/iptables stop ===執行關閉兩次,確保關閉; 法二: service iptables stop service iptables stop /etc/init.d/iptables status或者service iptables status ===修改完成後,再次查看iptables狀態; 2.2 永久關閉iptables(開機自啟動項關閉iptables) 查看iptables是否開機自啟動 chkconfig | grep ipt 或者chkconfig --list iptables 關閉iptables的開機自啟動項 chkconfig iptables off 再次查看iptables開機自啟動是否關閉 chkconfig | grep ipt 或者chkconfig --list iptables


Linux基礎優化之SElinux和iptables項

相關推薦

Linux基礎優化SElinuxiptables

linux基礎優化版權聲明: ########################################################################### 本文的所有內容均來自作者劉春凱的學習總結,未經本人許可,禁止私自轉發及使用。 QQ:1151887353 E-mail:[ema

Linux基礎知識ntpdntpdate的區別

在Linux作業系統設定與上級NTP時鐘源同步是很基本的操作,Linux提供了ntpd和ntpdate兩種方式來實現時間同步,但它們在同步原理上則有著本質的區別:ntpd在實際同步時間時是一點點的校準時間的,也可以理解為ntpd是平滑同步;而ntpdate不會考慮其他程式是否會陣痛,就立即同步。因此

Linux基礎知識chattrlsattr命令詳解

有時候你發現通過root使用者都不能修改某個檔案,大部分原因是曾經用chattr命令鎖定該檔案了。chattr命令的作用很大,其中一些功能是由Linux核心版本來支援的,不過現在生產絕大部分跑的linux系統都是2.6以上核心。通過chattr命令修改屬效能夠提高系統的安全性,但是它並不適合所有的目

Linux基礎知識bashrcprofile的用途區別

使用終端ssh登入Linux作業系統的控制檯後,會出現一個提示符號(例如:#或~),在這個提示符號之後可以輸入命令,Linux根據輸入的命令會做迴應,這一連串的動作是由一個所謂的Shell來做處理。 Shell是一個程式,最常用的就是Bash,這也是登入系統預設會使用的Shell。 bashrc和p

Linux基礎知識用戶用戶組以及 Linux 權限管理

space 屬性 並且 用戶表 相同 發行版 切換 用戶登錄 是什麽 已經開始接觸Linux用戶管理,用戶組管理,以及權限管理這幾個逼格滿滿的關鍵字。這幾個關鍵字對於前端程序猿的我來說真的是很高大上有木有,以前嘗試學 Linux 的時候看到這些名詞總是下意識的跳過不敢看有木

Linux基礎教程/dev/null/dev/zero的區別及其用法

在Linux作業系統中/dev/null和/dev/zero是兩個相似卻又很特殊的檔案,特別是在shell指令碼開發和系統運維過程中會經常用這兩個檔案,因此作為Linux系統工程師,你必須瞭解這兩個檔案的區別和用法。 一、/dev/null的用法: 我們可以把/dev/null檔案看作”黑洞”,它非

Linux效能優化定期清理保留 history 記錄

有經驗的 Linux 系統工程師都喜歡把 Bash 的 HISTSIZE/HISTFILESIZE 設定的很大,這樣可以記錄更多的歷史命令以便以後查閱,這是個好習慣,但有個小問題就是 history 記錄了的大量資訊在系統啟動後就被 load 到記憶體裡,並且一直儲存在記憶體裡,這樣浪費了不少記憶體

linux基礎命令pwdwhoami

inux etc root pwd oam 自身 whoami linu 目錄 常用命令: pwd: 顯示當前所在的工作目錄 實例: [root@itxuezh

Linux基礎命令文件目錄操作(一)

node var 慎用 con mkdir 環境 not 小數 mat pwd     print working directory的縮寫,作用是顯示當前工作目錄的絕對路徑,一般進行頻繁切換路徑時使用。     -L  顯示邏輯路徑(或略軟鏈接文件)

linux權限susudo的差別

進行 admins 是否 roo lai 表示 sudoers 還記得 平時 我們都知道非常多的文件都僅僅有root有權限來改動,那麽在我們平時的開發過程中都建議使用一般賬號來登錄進行開發。還記得前面說到的ssh嗎。我們也是將同意root登錄設置成no。

Linux基礎命令grep

模式匹配 lin 大小寫 表達式 ignore col -c 分組 nbsp grep : 根據pattern(模式)搜索文本,並將符合模式的文本行顯示出來,並不會修改原文件。 用法: grep [options] ‘ pattern ‘ /file #

Linux積累 命令catwc

名稱 line 組合 補充 linux 說明 conn ... 字數 cat主要有三大功能: 1.一次顯示整個文件。 $ cat filename 2.從鍵盤創建一個文件。 $ cat > filename 只能創建新文件,不能編輯已有文件. 3.將幾個文件合

Django基礎學習Cookie Sessions 應用

ima ges disco ttr 實現 保存 urn 傳遞 nwr 在Django裏面,使用Cookie和Session看起來好像是一樣的,使用的方式都是request.COOKIES[XXX]和request.session[XXX],其中XXX是您想要取得的東西的ke

Linux基礎系列--文件系統初識

linux 初識1、Linux Shell執行接口: (1)、GUI接口:圖形交互接口 X-Windows Gnome:C程序開發 KDE:C++程序開發 XFace:嵌入式輕量級的桌面 (2)、CLI接口:字符交互接

Linux基礎優化與安全重點小結

linux 優化01.不用root登錄管理系統,而以普通用戶登錄通過sudo授權管理。02.更改默認的遠程連接SSH服務端口,禁止root用戶遠程連接,甚至要更改SSH服務只監聽內網IP。03.定時自動更新服務器的時間,使其和互聯網時間同步。04.配置yum更新源,從國內更新源下載安裝軟件包。05.關閉S

linux基礎夯實磁盤分區原理知識

根目錄 不能 http linux 中一 oot 必須 時間 wap 磁盤分區時使用分區編輯器(partition editor)在磁盤上劃分幾個邏輯部分。碟片一旦劃分成數個分區(partition),不同類的目錄文件可以存儲進不同的分區。  最早的時候,分區只有一個分區:

Linux基礎命令文件管理

linux文件管理 BASH Shell 對文件進行管理=============================================================創建、復制、刪除、移動、查看、編輯、壓縮、查找內容提要:Linux目錄結構文件定位 路徑文件管理一:Linux的目錄通常

linux 基礎操作查找命令

文件 操作 工具 管道 默認 文件名 格式 linux 基礎 屬組 2018-01-26 命令 : whereis (查找最快的一個,但是只能查找二進制程序、文檔和源碼。 命令格式:   whereis [選項]     -b 查找2進制程序     -m 查找文

linux基礎知識vi編輯器的使用

所在 unix .com 文章 插入 oot 更改 位置 tro 在介紹vi編輯器之前,我們先了解一下Linux系統中別名的使用(文章知識書寫來自博主蟲師,感謝博主) 別名就是不同的兩個名字指的是一個人,不同的兩個命令具有相同的作用。 現在,你一定很想知道自己的

Linux基礎優化

Linux 內核參數Linux系統出現性能瓶頸(IO/CPU/MEM)時如其大費周章進行軟件調優,還不如從硬件方面來解決更合理,軟件方面的調優性能增加是微乎其微的。因為在系統部署初期已經對參數進行了合理的設置。Linux系統軟件方面調優也就是讓參數設置更加合理,從而達到性能上提高。 一.Linux系統基礎優化