linux命令集合

本文介绍如何使用Linux下的iptables命令来封禁或解除封禁特定IP地址及端口的方法。涵盖添加规则以阻止IP访问、阻止特定端口访问、删除规则以解除封禁等内容,并提供保存规则的方法。

find

  1. not find subfolder
    find . -maxdepth 1 -type f

cp only files exclude currect folder

find . -maxdepth 1 -type f | xargs -i cp {} target/

NTP update

ntpupdate ip
date -s dd:mm:ss

ntp开机自启动
chkconfig ntpd on
chkconfig ntpd off 
chkconfig ntpd --level 23 on
chkconfig ntpd --level 23 off
Solaris11 root无法SSH登陆

vi /etc/user_attr
#root::::type=role或者root::::type=normal
vi /etc/ssh/sshd_config
PermitRootLogin yes
svcadm restart ssh

Solaris11 block ip port
  • echo ‘block out log quick proto tcp from any to any port = 3306’
  • echo ‘block in log quick proto tcp from any to any port = 3306’
  • svcadm disable svc:/network/ipfilter:default
  • sleep 2
  • svcadm enable svc:/network/ipfilter:default
  • sleep 2
Linux block and unblock ip port

refer to https://www.basezap.com/block-unblock-ip-address-linux/}
Requirements

Root Access to the Linux System

Procedure

Login to the server as the root user
Follow the Syntax below for various iptables rules.
Note – Replace IP-ADDRESS-HERE with the particular IP address and port_number with the port.

    Add iptables rule to block IP Address
    iptables -A INPUT -s IP-ADDRESS-HERE -j DROP
    Add iptables rule to block IP Address access to a specific port
    iptables -A INPUT -s IP-ADDRESS-HERE -p tcp --destination-port port_number -j DROP
    Drop/Remove iptables rule to unblock IP Address
    iptables -D INPUT -s IP-ADDRESS-HERE -j DROP
    Drop/Remove iptables rule to unblock IP Address access to a specific port
    iptables -D INPUT -s IP-ADDRESS-HERE -p tcp --destination-port port_number -j DROP
After adding/removing any of the above rules we need to save the iptables rules by the following command.
iptables-save

With these few commands, we finish the iptables block and unblock rules.

Check/Verify if a particular IP is blocked using iptables.

iptables -L INPUT -v -n | grep “IP-ADDRESS-HERE”

BLOCK CONN to MYSQL

iptables -I OUTPUT -p tcp --destination-port 3306 -j DROP --INSERT TO DEFAULT
iptables -A OUTPUT -p tcp --destination-port 3306 -j DROP --ADD
iptables -D OUTPUT -p tcp --destination-port 3306 -j DROP --DROP

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值