wiki'd

by JoKeru

Triggering Commands On File/Directory Changes

[cc lang='bash']
\$ apt-get install incron

\$ echo 'root' > /etc/incron.allow
\$ incrontab -e \<- add "/etc/apache2/sites-enabled/ IN_MODIFY /etc/init.d/apache2 reload"
\$ /etc/init.d/incrond start
[/cc]

OpenWRT USB Storage

$ opkg update

$ opkg install kmod-usb-core kmod-scsi-core kmod-usb-storage kmod-usb2 kmod-fs-ext2

$ opkg install e2fsprogs
$ dmesg | grep 'scsi'
$ mkfs.ext2 /dev/scsi/host0/bus0/target0/lun0/part1

$ mkdir /backup-usb
$ mount -t ext2 -o noatime /dev/scsi/host0/bus0/target0/lun0/part1 /backup-usb

$ vi /etc/init.d/usb-mount
$ chmod +x /etc/init.d/usb-mount …

HomeMade DynDNS

The solution is simple:

  • on the server (10.20.30.40) hosting the DNS Server (bind) we'll create a listener (a nc infinite loop) that will update & reload the service when there is an IP change on the client
  • on the client having dynamic IP we'll configure a cronjob that …

TCP Tuning for busy systems

[cc lang="bash"]
\$ vi /etc/sysctl.conf

# The wait time before TCP/IP can release a closed connection
net.ipv4.tcp_fin_timeout = 15
# The wait time between isAlive interval probes
net.ipv4.tcp_keepalive_intvl = 15
# The number of probes before timing out
net.ipv4.tcp_keepalive_probes = 5
# Reuse sockets in the time-wait state …

Test Socks Proxy with cURL

$ curl --interface 10.20.30.40 --socks5 11.22.33.44:30180 http://www.ceipam.ro/ | grep title

SRG - Squid Report Generator

[cc lang="bash"]
\$ apt-get install srg

\$ vi /etc/default/srg
\$ vi /etc/srg/srg.conf
\$ vi /etc/cron.daily/srg
[/cc]

/etc/default/srg
[cc lang="bash"]
REPORTBASE=/var/www/srg
CONFIGFILE=/etc/srg/srg.conf
MAILUSER=""
DAILY_REPORT_RETAIN_DAYS="180"
[/cc]

/etc/srg/srg.conf
[cc lang="bash"]
log_file "/var/log …

Test WEB Proxy with cURL

$ curl -Lv -U "username:password" -x "proxy_ip:proxy_port" "http://google.com"  

PPTP Server on Ubuntu

[cc lang="bash"]
\$ apt-get install pptpd bcrelay

\$ vi /etc/pptpd.conf
\$ vi /etc/ppp/pptpd-options
\$ vi /etc/ppp/chap-secrets
\$ /etc/init.d/pptpd restart

\$ netstat -tulnp | grep pptpd
[/cc]

/etc/pptpd.conf
[cc lang="bash"]
listen 10.20.30.40
option /etc/ppp/pptpd-options
logwtmp
localip 192.168.20.1 …

GUI Desktop (Xfce) on Ubuntu Server VPS

Install a graphical environment (X, GUI) & VNC server on your Linux VPS server to connect to it from your computer and use it as a desktop computer:

$ apt-get install xorg

The following NEW packages will be installed:
intel-gpu-tools libfs6 libgl1-mesa-dri libgl1-mesa-glx libglu1-mesa
libpciaccess0 libxcursor1 libxdamage1 libxfixes3 libxi6 libxinerama1
libxkbfile1 libxrandr2 …