Category Archives: Linux

WireGuard VPN Iptables Rules

Here are “iptables -S” rules for WireGuard VPN server: -P INPUT ACCEPT -P FORWARD ACCEPT -P OUTPUT ACCEPT -A FORWARD -i ens2 -o wg0 -j ACCEPT -A FORWARD -i wg0 -j ACCEPT-P INPUT ACCEPT -P FORWARD ACCEPT -P OUTPUT ACCEPT -A FORWARD -i ens2 -o wg0 -j ACCEPT -A FORWARD -i wg0 -j ACCEPT You […]

How to Install WireGuard VPN in Debian 10 Buster

Here is how to install WireGuard VPN in Debian Buster in 60 seconds: apt-get update; apt-get dist-upgrade -y wget https://raw.githubusercontent.com/angristan/wireguard-install/master/wireguard-install.sh -O wireguard-install.sh chmod +x wireguard-install.sh ./wireguard-install.shapt-get update; apt-get dist-upgrade -y wget https://raw.githubusercontent.com/angristan/wireguard-install/master/wireguard-install.sh -O wireguard-install.sh chmod +x wireguard-install.sh ./wireguard-install.sh Then simply follow instructions, that’s all. I am attaching the .sh file also here (in case it […]

Bash: No space left on device (inodes issue)

With “df -h” you may get like if all is fine, however… This generally is an inodes issue, try to run this: df -idf -i And you should see which partition has no space left. Then try to run this command to know the real directory size: du -sh /path/*du -sh /path/* Once you know […]

How to Install OpenVPN in Debian 10 Buster

Here is how to install OpenVPN v2.4.7+ in Debian Buster in 60 seconds: apt-get update; apt-get dist-upgrade -y wget https://raw.githubusercontent.com/Angristan/openvpn-install/master/openvpn-install.sh -O debian10-vpn.sh chmod +x debian10-vpn.sh ./debian10-vpn.shapt-get update; apt-get dist-upgrade -y wget https://raw.githubusercontent.com/Angristan/openvpn-install/master/openvpn-install.sh -O debian10-vpn.sh chmod +x debian10-vpn.sh ./debian10-vpn.sh Then simply follow instructions, that’s all. I am attaching the .sh file also here (in case it […]

How to Allow Specific IP Addresses in OpenVPN Server

The best and safest way to allow only specific IP addresses to use your VPN is by using iptables. First you need to add your accept (allow) rules and then you add a rule to drop (deny) all other traffic, example: iptables -A INPUT -s 1.2.3.4/32 -i eth1 -p udp -m udp –dport 1194 -j […]

Linux Delete Files Older Than 3 Months Bash

This bash command will print all files older than 3 months: find /path/to/root/folder/*.log -type f -mtime "+$(( ( $(date ‘+%s’) – $(date -d ‘3 months ago’ ‘+%s’) ) / 86400 ))" -printfind /path/to/root/folder/*.log -type f -mtime "+$(( ( $(date ‘+%s’) – $(date -d ‘3 months ago’ ‘+%s’) ) / 86400 ))" -print Use -delete to […]

Linux Delete Empty Directories Recursively Bash

This bash command will print all empty directories: find /path/to/root/folder/ -type d -empty -printfind /path/to/root/folder/ -type d -empty -print Use -delete to delete all matches: find /path/to/root/folder/ -type d -empty -deletefind /path/to/root/folder/ -type d -empty -delete

Debian Apt-get N: Repository Changed Its Version

If you get this message after apt-get update on a Debian server: N: Repository ‘http://mirrors.online.net/debian buster InRelease’ changed its ‘Version’ value from ‘10.4’ to ‘10.5’N: Repository ‘http://mirrors.online.net/debian buster InRelease’ changed its ‘Version’ value from ‘10.4’ to ‘10.5’ Then just run this once: apt-get update –allow-releaseinfo-changeapt-get update –allow-releaseinfo-change

Example Linux server error logs when CPU is faulty

Error messages displayed in the SSH shell: Message from syslogd@server at Aug 8 11:27:49 … kernel:[4665156.435610] NMI: IOCK error (debug interrupt?) for reason 61 on CPU 0.   Message from syslogd@server at Aug 8 11:28:08 … kernel:[4665175.398187] NMI: IOCK error (debug interrupt?) for reason 61 on CPU 0.   Message from syslogd@server at Aug 8 […]

Output multiple Linux commands into columns

You can run multiple Linux commands and get the output for each command delimited by a column: paste -d’|’ <(echo "$VAR1") <(echo "$VAR2") <(echo "$VAR3") <(echo "$VAR4")paste -d’|’ <(echo "$VAR1") <(echo "$VAR2") <(echo "$VAR3") <(echo "$VAR4") You can also run commands “inline” inside $(), example: paste -d’|’ <(echo $(pwd)) <(echo $(id))paste -d’|’ <(echo $(pwd)) <(echo […]