命令
2025-09-23 09:41:40

记录一些常用命令

1.certbot ssl dns

cat /etc/letsencrypt/cloudflare.ini

dns_cloudflare_api_token =  cloudflare_api_tokens

certbot certonly \
  --dns-cloudflare \
  --dns-cloudflare-credentials /etc/letsencrypt/cloudflare.ini \
  --dns-cloudflare-propagation-seconds 30 \
  --key-type ecdsa \
  --domain "archs.cn,*.archs.cn"

2.查看开机到现在流量使用

ip -s -h link

3.按上行流量服务器流量控制,达量关机

在eth0网卡TX流量大于1500G的时候执行关机命令,将此命令添加到定时执行计划并且替换为你需要的命令如关闭服务器或者执行限制操作

ip命令流量最小使用bytes显示,使用-h时使用1000进制显示M,G级别流量,使用1000可以做到与ip -s -h address显示流量完全一致,也可以替换为1024

ip -s address show eth0 | awk -v max=1500 'END{tx=$1/1000/1000/1000;if(tx>max)system("halt")}'

4.ssh关闭root登录和只允许key登录

#PermitRootLogin yes

PermitRootLogin no

#PasswordAuthentication yes

PasswordAuthentication no

5.ArchLinux GPG抽风解决办法

pacman-key --init

pacman-key --populate
or
pacman-key --populate archlinux
#vi /etc/pacman.d/mirrorlist
pacman -Syy
pacman -S archlinux-keyring
pacman -Syyu
Prev
2025-09-23 09:41:40
Next