Summary of Common commands in Linux (7) Security Settings and Common commands in linux
Security Settings |
Category |
Command |
Option |
Annotation |
Security Policy Selinux |
Setenforce |
Number (0, 1) |
Set selinux status, 0 closed, 1 Enabled |
Getenforce |
|
Displays the current selinux status. enforcing indicates enabled, and permissive indicates disabled. |
Firewall |
Iptables |
Three tables: filter, nat, and mangle |
For example, iptables-a input-p tcp -- dport 22-j ACCEPT |
-A (-I,-D) |
Add (insert, delete) a rule |
INPUT (OUTPUT, FORWARD) |
Chain name |
-S |
Source Address |
-P |
Protocol (tcp, udp, icmp) |
-- Sport/-- dport |
Followed by the source port/Target Port |
-D |
Followed by the destination IP address |
-J |
Followed by the action after the rule is triggered. DROP/REJECT/ACCEPT |
Shutdown/restart |
Shutdown |
[Option] |
Shutdown |
-T |
Number of seconds after Shutdown |
-R |
Restart after shutdown at the specified time |
-H |
Shutdown at specified time |
-C |
Cancel ongoing shutdown |
Halt |
[Option] |
Pending |
-P |
Shutdown |
Reboot |
|
Restart = shutdown-r now |