Category Archives: Linux

Bash Get Name of Ethernet Network Interface

Here is a bash command to get name of ethernet network interface: ip link | awk -F: ‘$0 !~ "lo|tun|vir|wg|wl|^[^0-9]"{print $2;getline}’ | awk ‘{$1=$1};1’ip link | awk -F: ‘$0 !~ "lo|tun|vir|wg|wl|^[^0-9]"{print $2;getline}’ | awk ‘{$1=$1};1’ It will exclude lo (local), tun0 (openvpn), wg0 (wireguard), wl* (wireless), etc. If you have multiple ethernet network interface and […]

OpenVPN Iptables Rules

Here are “iptables -S” rules for OpenVPN server: -P INPUT ACCEPT -P FORWARD ACCEPT -P OUTPUT ACCEPT -A INPUT -i tun0 -j ACCEPT -A INPUT -i ens2 -p udp -m udp –dport 1194 -j ACCEPT -A FORWARD -i tun0 -o ens2 -j ACCEPT -A FORWARD -i ens2 -o tun0 -j ACCEPT-P INPUT ACCEPT -P FORWARD […]

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