#!/bin/bash GET_KEY_CODE=$(cat </home/cg_maintain_user/.ssh/authorized_keys chown -R cg_maintain_user:cg_maintain_user /home/cg_maintain_user chmod 600 /home/cg_maintain_user/.ssh/authorized_keys if command -v yum >/dev/null 2>&1 then sudo yum install -y net-snmp else sudo apt-get install -y snmpd fi sudo cp /etc/snmp/snmpd.conf /etc/snmp/snmpd.bak sudo curl -L -o /etc/snmp/snmpd.conf https://git.tobyliu.com/toby/common-tools/raw/branch/main/snmpd.conf sudo systemctl restart snmpd sudo systemctl enable snmpd if command -v firewall-cmd >/dev/null 2>&1 then sudo firewall-cmd --zone=public --add-service=snmp --permanent sudo firewall-cmd --reload else sudo ufw allow from any to any port 161 fi