Last active
December 14, 2022 09:26
-
-
Save 0x0a0d/8a228f16ca0ad769ed33cff79608d5bb to your computer and use it in GitHub Desktop.
vccloud init
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| #https://askubuntu.com/questions/259739/kswapd0-is-taking-a-lot-of-cpu | |
| echo 1 | sudo tee /proc/sys/vm/drop_caches | |
| # ssh port | |
| rand_port=0 | |
| while [[ $rand_port -lt 10000 ]] | |
| do | |
| rand_port=$(($RANDOM * 2)) | |
| done | |
| echo '[+] SSH PORT: '$rand_port | |
| sed -i 's/^Port 22$/Port '$rand_port'/' /etc/ssh/sshd_config | |
| systemctl restart ssh | |
| # apt mirror | |
| sed -i 's/mirror.vccloud.vn/mirrors.bkns.vn/' /etc/apt/sources.list | |
| apt update | |
| # netstat | |
| which netstat || apt install net-tools -y | |
| ln -sf /run/systemd/resolve/resolv.conf /etc/resolv.conf | |
| sed -i 's/^#*DNS=/DNS=1.1.1.1 8.8.8.8 208.67.222.222/' /etc/systemd/resolved.conf | |
| sed -i 's/domain-name-servers,/\n#domain-name-servers,\n/' /etc/dhcp/dhclient.conf | |
| sed -i 's/domain-search,/\n#domain-search,\n/' /etc/dhcp/dhclient.conf | |
| sed -i 's/^#prepend/prepend domain-name-servers 8.8.8.8;\n#prepend/' /etc/dhcp/dhclient.conf | |
| sed -i 's/^#prepend/prepend domain-name-servers 1.1.1.1;\n#prepend/' /etc/dhcp/dhclient.conf | |
| dhclient -r | |
| service systemd-resolved restart |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
wget -O - https://gist.githubusercontent.com/0x0a0d/8a228f16ca0ad769ed33cff79608d5bb/raw/vccloud-init.sh | bash