Category: Webmaster Tools

Perl Script to Find and Delete Duplicate Files for Backup Purposes

A useful script to remove duplicate files, especially designed for saving space for backup purposes. What the program does; finds all files in a Source Directory, puts them into an array, then finds all files in a Target Directory, putting those into another array (edit accordingly). The arrays are compared for matching file names. Matches are then compared for file...

GREP SED AWK VI and FIND Usage Notes for Webmasters

When it comes to manipulating files, you can do almost anything with GREP SED AWK VI and FIND (and I’m a novice). My notes (taken from far more capable individuals online than I. Thank you all for the education.) File manipulation using AWK, GREP, SED, FIND, VI AWK AWK to extract IPs from logs Lists of IPs from log file...

How to Enable PHP Error Logging

sudo vi /etc/php5/apache2/php.ini error_reporting = E_ALL | E_STRICT error_log = /var/log/php_errors.log You must create the (log) file manually touch /var/log/php_errors.log chown www-data: /var/log/php_errors.log chmod +rw /var/log/php_errors.log

How to Change or Disable SSH Timeout

On Client sudo vi /etc/ssh/ssh_config add line ServerAliveInterval 100 On Server sudo vi /etc/ssh/sshd_config add lines ClientAliveInterval 30 TCPKeepAlive yes ClientAliveCountMax 99999 From command line per session ssh -o ConnectTimeout=10 ssh -o ConnectTimeout -o BatchMode=yes -o StrictHostKeyChecking=no ServerAliveInterval operates on the ssh layer. It will actually send data through ssh, so the TCP packet has encrypted data in and a...

How to Rescue Hetzner VServer

Activate Rescue Mode Copy Password to clipboard Restart (reset) Server login ssh -v root@ip mount filesystem mount /dev/md2 /mnt or mount home mount /dev/md3 /mnt cd /mnt/___________ < be careful to always cd into mnt then the directory of choice or you will be cd into the rescue file system

ddclient for DynDNS Setup on Debian 7

# Configuration file for ddclient # # /etc/ddclient.conf ## ddclient configuration file daemon=600 # check every 600 seconds syslog=yes ## Default options protocol=dyndns2 ## Detect IP with our CheckIP server use=web, web=checkip.dyndns.com, web-skip=’IP Address’ server=members.dyndns.org # log update msgs to syslog mail-failure=user@gmail.com # Mail failed updates to user pid=/var/run/ddclient.pid # record PID in file. ## DynDNS username and password here...

what is s.ytimg.com

YouTubeIMaGe – s.ytimg.com means YouTube image https://support.mozilla.org/en-US/questions/953550 This is a tracker that you can change as follows https://support.mozilla.org/en-US/kb/enable-and-disable-cookies-website-preferences If you place YouTube videos on you website, you may not want to place them on your Home Page for speed considerations, as this tracker tends to be the slowest component. Check that here http://tools.pingdom.com/fpt/ Pingdom website Speed Test Personally hate Adobe...

Perl Modules won’t Install on Debian Server

/usr/bin/make — NOT OK Failed during this command: Anytime you cannot get a Perl package to install, here is the likely problem. Run these: sudo apt-get install build-essential What is wrong : a Debian Server install intentionally does not contain development tools for security and efficiency reasons. So when you attempt to run Perl, you find that you can’t get...

404 Page Not Found – Craigslist Search Engine by State

I once wrote a Perl script for crawling Craigslist for a particular product. It could be used for localized results, but the real benefit is price comparison capabilities (price arbitrage) by having global results for reference. It is very useful for some products, especially collectibles. I once used it to buy a rare guitar I was wanting. Average prices in...

Install Truecrypt

Note: When installing Truecrypt on a new linux system, the most common failure (install simply stops without an error message) is due to the permissions of the user. Make sure the user has been added to sudoers group and reboot (or logout and login again), or you will get the massage “user not in sudoers group”. Download Truecrypt Download signature...

Harden Debian 7 Server with PSAD

Install Port Scan Attack Detector on Debian 7 Server sudo apt-get install psad sudo vi /etc/psad/psad.conf change these lines EMAIL_ADDRESSES me@seleads.com; HOSTNAME my.seleads.com; HOME_NET NOT_USED; ALERTING_METHODS noemail; IPT_SYSLOG_FILE /var/log/syslog; EMAIL_LIMIT_STATUS_MSG N; ENABLE_AUTO_IDS Y; AUTO_IDS_DANGER_LEVEL 2; AUTO_BLOCK_TIMEOUT 2592000; ENABLE_AUTO_IDS_EMAILS N; Restart psad psad -R psad –sig-update psad -H sudo vi /etc/cron.hourly/save-bad-ips #!/bin/sh PATH=/usr/share:/usr/sbin:/usr/bin:/sbin:/bin /sbin/iptables-save -c > /tmp/iptables-save.txt #echo “SELECT lockdown_IP FROM...

Netfilter iptables Log Message Codes

IN = Input interface OUT = Output interface MAC = Ethernet hardware address (aka MAC address) SRC = Source IP address DST = Destination IP address LEN = Packet length TOS = Type of Service (for packet prioritization) PREC = Precedent bits TTL = Time to Live ID = Packet identifier PROTO = Protocol (eg. TCP, UDP) SPT = Source...

Apache Permissions on ServerRoot Directories

Apache Permissions on ServerRoot Directories In typical operation, Apache is started by the root user, and it switches to the user defined by the User directive to serve hits. As is the case with any command that root executes, you must take care that it is protected from modification by non-root users. Not only must the files themselves be writable...

FIND Command Usage Notes for Webmasters

File manipulation using FIND These examples are Ubuntu 12.04 and Apache2 FIND find a file by name # sudo find ~/ -name ‘banner3.jpg’ 2>/dev/null find and copy # combined to make a script to double filter sudo find /media/backup01/* -name ‘*.txt’ -exec cp {} ~/dump \; + increases speed sudo find . -name ‘*.py’ -exec grep –color ‘xrange’ {} +...

Eliminate error “127.0.0.1 Directory index forbidden by Options directive” in log files (and other needless noise)

Ubuntu Apache Error : client 127.0.0.1 Directory index forbidden by Options directive This error and many others clog your log files with noise which can be easily eliminated without compromising security. The reason I get this error is because I have set .htaccess in the server root directory to Options -Index for security reasons. I don’t want anyone browsing /var/www...