Featured image of post 🧰工具箱|一些常用的Linux命令

🧰工具箱|一些常用的Linux命令

Worked well on Ubuntu 22.04

  • 以下命令适用于Ubuntu 22.04系统,其他系统自行修改。
  • 可以透过右侧Widget目录快速查找。
  • 本文的命令大多是一键脚本,有其他顾虑请自行打开脚本审阅。
  • 因为要常更新,所以不做多语言支持。
  • 来源于互联网,有侵权请联系我删除。
  • featured image

开机

修改为root密码登录ssh

#!/bin/bash
echo root:改我 |sudo chpasswd root
sudo sed -i 's/^#\?PermitRootLogin.*/PermitRootLogin yes/g' /etc/ssh/sshd_config;
sudo sed -i 's/^#\?PasswordAuthentication.*/PasswordAuthentication yes/g' /etc/ssh/sshd_config;
sudo service sshd restart
  • 将汉字部分替换成你要修改的ssh登录密码,建议使用密码管理器生成随机强密码。
  • 「适用于甲骨文」: 粘贴到开机页面 高级选项 –> 粘贴Cloud-init脚本 里面

关闭系统防火墙

iptables -P INPUT ACCEPT
iptables -P OUTPUT ACCEPT
iptables -P FORWARD ACCEPT
iptables -F
  • 一般的VPS输入这四行就行,甲骨文还要输入下面两行:
iptables-save > /etc/iptables/rules.v4      
ip6tables-save > /etc/iptables/rules.v6  

修改ssh端口

公网高强度扫描爆破ssh主要针对默认的22端口,为了防止一些不必要的损失,按照下面的指令修改为35768端口吧!

sed -i 's/#Port 22/Port 35768/' /etc/ssh/sshd_config
service ssh restart
  • Port 35768 可替换为 1-65535 之间的任何数字

  • 如果没把握,可以再处理一遍防火墙。

  • 检查一下ssh监听端口是否更改成功。

sudo apt install netstat 
netstat -antp |grep ssh 
  • 如果操作iptables后发现和docker相关的服务不能访问,记得运行 systemctl stop docker systemctl start docker

增强

BBR加速

wget -N --no-check-certificate "https://raw.githubusercontent.com/chiakge/Linux-NetSpeed/master/tcp.sh" && chmod +x tcp.sh && ./tcp.sh
  • 如果没效果可以试试下面的不卸载内核版本:
wget -N --no-check-certificate "https://github.000060000.xyz/tcpx.sh" && chmod +x tcpx.sh && ./tcpx.sh

宝塔面板

官方版

wget -O install.sh http://download.bt.cn/install/install-ubuntu_6.0.sh && sudo bash install.sh ed8484bec

开心版

wget -O install.sh http://io.bt.sy/install/install-ubuntu_6.0.sh && sudo bash install.sh

国外版(aaPanel)

wget -O install.sh http://www.aapanel.com/script/install-ubuntu_6.0_en.sh && sudo bash install.sh aapanel

DD

先安装必需依赖

apt-get install -y xz-utils openssl gawk file wget screen && screen -S os

然后在screen下运行

wget --no-check-certificate -O NewReinstall.sh https://git.io/newbetags && chmod a+x NewReinstall.sh && bash NewReinstall.sh
  • 脚本里面有很多系统版本,按照脚本注释选择。
  • 如果10分钟以后连不上主机,请去控制台处理一遍防火墙。

查看流媒体解锁情况

经典永流传版

bash <(curl -L -s https://raw.githubusercontent.com/lmc999/RegionRestrictionCheck/main/check.sh)

由Neko提供的更快的脚本

bash <(curl -Ls unlock.moe)
  • 只检测IPv4结果: bash <(curl -Ls unlock.moe) -m 4
  • 只检测IPv6结果: bash <(curl -Ls unlock.moe) -m 6

测速

wget -qO- --no-check-certificate https://raw.githubusercontent.com/oooldking/script/master/superbench.sh | bash

查看线路信息

curl https://raw.githubusercontent.com/zhucaidan/mtr_trace/main/mtr_trace.sh|bash

安全

查看SSH登陆日志

grep "Failed password" /var/log/auth.log | wc -l

搭建

Snell

wget -O snell.sh --no-check-certificate https://git.io/Snell.sh && chmod +x snell.sh && ./snell.sh

MTProto代理

curl -o MTProtoProxyInstall.sh -L https://git.io/fjo34 && bash MTProtoProxyInstall.sh

http代理

curl -L https://raw.githubusercontent.com/snail007/proxy_admin_free/master/install_auto.sh | bash

Socks5代理

wget -q -N --no-check-certificate https://raw.githubusercontent.com/wyx176/nps-socks5/master/install.sh && chmod 777 install.sh && bash install.sh
  • 附带管理面板
    • 面板地址:yourIP:18080
    • 默认账号密码:admin admin
  • GitHub地址:NPS-Socks5

一键转发

wget --no-check-certificate -qO natcfg.sh https://raw.githubusercontent.com/arloor/iptablesUtils/master/natcfg.sh && bash natcfg.sh

More to be continued..


欢迎加入我的Telegram聊天群:https://t.me/hututu000 😻


感谢

Licensed under CC BY-NC-SA 4.0
Last updated on Apr 02, 2023 19:50 +0800
Supports IPv6, HTTP/3, TLS 1.3 & DNSSEC