脚本
蓝~天~
这个作者很懒,什么都没留下…
展开
-
alpine换源和pip换源、pip安装
阿里镜像sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories科大镜像sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories原创 2022-02-07 18:51:31 · 2797 阅读 · 0 评论 -
ssh免密脚本
cat > hosts.list << 'EOF'192.168.149.22192.168.149.23192.168.149.24EOFcat > push_ssh_key.sh << 'EOF'#!/bin/bashrpm -q sshpass &> /dev/null || yum -y install sshpass[ -f /root/.ssh/id_rsa ] || ssh-keygen -f /root/.ss原创 2021-09-23 10:46:59 · 185 阅读 · 0 评论 -
centos8更改为阿里镜像源
curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-8.repocat > /etc/yum.repos.d/CentOS-Base.repo << 'EOF'[base]name=CentOS-$releasever - Base - mirrors.aliyun.comfailovermethod=prioritybaseurl=https://mirrors.al原创 2021-08-13 12:24:17 · 1804 阅读 · 0 评论 -
alpine安装curl
sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositoriesapk add curl原创 2021-07-26 11:19:48 · 2205 阅读 · 0 评论 -
ssh受限用户
#!/bin/bash#判断是否已存在用户grep "log_user" /etc/passwd >/dev/nullif [ $? -eq 0 ]; then echo "already exists" exit 0fi#创建用户useradd -d /home/log_user -m log_userecho "password" | passwd --stdin log_user#指定文件权限位mkdir -p /home/log_user/dev/cd /ho原创 2020-12-10 06:42:25 · 146 阅读 · 0 评论 -
python HTTP服务调用socket,进行端口连通性检测
参考:https://blog.51cto.com/jaysonzhang/1200405#!/usr/bin/python# -*- coding: UTF-8 -*-from BaseHTTPServer import * import socket import reclass Handler(BaseHTTPRequestHandler): def process(self): try: ip = self.path.split('?原创 2021-04-30 11:38:31 · 520 阅读 · 0 评论 -
centos7 kernel 升级内核
rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.orgrpm -Uvh http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpmyum --disablerepo="*" --enablerepo="elrepo-kernel" list availableyum --enablerepo=elrepo-kernel install kernel-ml查看是否另类引原创 2021-04-20 18:53:39 · 432 阅读 · 0 评论 -
linux下nodejs的二进制安装
wget https://npm.taobao.org/mirrors/node/v14.16.0/node-v14.16.0-linux-x64.tar.xztar xvf node-v14.16.0-linux-x64.tar.xzmkdir /datamv node-v14.16.0-linux-x64 /data/nodejsln -s /data/nodejs/bin/* /usr/bin/npm install yarn原创 2021-04-15 18:06:31 · 734 阅读 · 0 评论 -
Linux安全基线脚本
hostnameUSERNAME="user"PASSWORD="xxxxxxx"echo "口令更改最小间隔天数:"cp /etc/login.defs /etc/login.defs_bak_$(date +%Y-%m-%d)sed -i "/PASS_MIN_DAYS/s/1/7/g" /etc/login.defs grep PASS_MIN_DAYS /etc/login.defs|grep -v ^#echo -e "\n"echo "认证失败次数:"cp /etc/p原创 2021-03-10 18:10:46 · 736 阅读 · 0 评论 -
docker清理
清理docker0、flannel、kube-ipvs0、dummy0网络yum -y install bridge-utilsifconfig docker0 downbrctl delbr docker0ip link del flannel.1ip link del kube-ipvs0ip link del dummy0清理所有docker运行镜像docker ps -a|awk '{print $1}'|grep -v CONTAINER|xargs docker r.原创 2020-12-11 13:18:49 · 972 阅读 · 0 评论 -
systemctl的service模板
/etc/systemd/system/xxxx.service[Unit]Description={{service_name}} ServiceAfter=network.targetAfter=network-online.targetWants=network-online.target[Service]User={{rio_user|default('root')}}Group={{rio_group|default('root')}}Type={{systemd_type |原创 2021-03-02 16:32:40 · 697 阅读 · 0 评论 -
openssh+openssl修改版本号
strings /usr/sbin/sshd | grep OpenSSHstrings /usr/lib64/libcrypto.so.10 | grep openssl备份 sshd和opensslcp /usr/sbin/sshd /usr/sbin/sshd.bak`date +%F`cp /lib64/libcrypto.so.10 /lib64/libcrypto.so.10.bak`date +%F`sed -i 's/OpenSSH_8.0/OpenSSH_8.4/g'原创 2020-11-24 17:47:02 · 995 阅读 · 0 评论 -
centos下删除docker0网卡
yum -y install bridge-utilsifconfig docker0 downbrctl delbr docker0原创 2020-11-04 11:19:46 · 1643 阅读 · 0 评论 -
strace命令使用
参考 https://www.cnblogs.com/youxin/p/8837771.html1、 查询读取配置文件strace php 2>&1 | grep php.ini2、查看CPU使用情况strace -C -p pidstrace -c -p pid3、显示耗时strace -tt -T -C >/dev/null ls4、显示网络耗时strace -e poll,select,connect,recvfrom,sendto nc www.news.com原创 2020-10-28 14:16:16 · 586 阅读 · 0 评论 -
centos7 二进制安装docker和docker-compose(amd64,arch64)
install_docker.sh#!/bin/bash#docker版本version=19.03.9#docker安装路径install_path=/opt#下载docker二进制安装文件if [ ! -f "docker-${version}.tgz" ]; then#wget https://download.docker.com/linux/static/stable/x86_64/docker-${version}.tgzcurl https://download.docke原创 2020-10-26 15:05:25 · 679 阅读 · 0 评论