Tag archive for ‘Shell’

Shell script to create list of backup files in ~/.mybackup file. Use with mybackup shell script

#!/bin/bash # mybackupadd – Add file to ~/.mybackup file, then backup and email all # file as tar.gz to your email a/c. # # Usage : ./mybackupadd ~/public_html/ # # Copyright (C) 2004 nixCraft project # Email : http://cyberciti.biz/fb/ # Date : Aug-2004 # ————————————————————————- # This program is free software; you can redistribute it [...]

Linux Iptables Just Block By Country

I admin ecom website and a lot of bogus traffic comes from countries that do not offer much in commercial value. How do I just configure Apache or iptables to just refuse connections to certain countries? You can block traffic at both Apache or iptables level. I recommend iptables to save some resources. First, you [...]

Shell Script To Build And Install PHP Xcache Opcode Cache Extension

#!/bin/bash # A simple shell to build and install xcache Opcode Cache as module for # PHP under # CentOS, Fedora and RHEL / Redhat Enterprise Linux # servers. # —————————————————————————- # Written by Vivek Gite <http://www.cyberciti.biz/> # (c) 2008 nixCraft under GNU GPL v2.0+ # —————————————————————————- # Home page: http://www.hardened-php.net # Last updated: 15/June/2010 [...]

Shell Script To Build dnstop Utility To Displays Various Tables Of DNS Server Traffic

#!/bin/bash # A shell script to build dnstop utility to displays various tables # of DNS traffic on your network including bind 9 server stats. # ————————————————————————- # Tested under CentOS / RHEL / Fedora Linux only. # ————————————————————————- # Copyright (c) 2008 nixCraft project <http://cyberciti.biz/fb/> # This script is licensed under GNU GPL version [...]

nginx Chroot Helper Bash Shell Script To Copy Libs To /lib64 and /usr/lib64

#!/bin/bash set -e # Use this script to copy shared (libs) files to nginx chrooted # jail server. This is tested on 64 bit Linux (Redhat and Friends only) # —————————————————————————- # Written by Vivek Gite <http://www.cyberciti.biz/> # (c) 2006 nixCraft under GNU GPL v2.0+ # Last updated on: Apr/06/2010 by Vivek Gite # —————————————————————————- [...]

Shell Script To Build And Install PHP Security Model Suhosin

#!/bin/bash # A simple shell to build and install suhosin as module for PHP under # CentOS, Fedora and RHEL / Redhat Enterprise Linux servers. # —————————————————————————- # Written by Vivek Gite <http://www.cyberciti.biz/> # (c) 2009 nixCraft under GNU GPL v2.0+ # —————————————————————————- # Home page: http://www.hardened-php.net # Last updated: 15/June/2010 # —————————————————————————- VERSION=”-${2:-0.9.31}” URL=”http://download.suhosin.org/suhosin${VERSION}.tgz” [...]

Shell script to find all programs and scripts with setgid bit set on

setuid and setgid (short for set user ID upon execution and set group ID upon execution, respectively) are Unix access rights flags that allow users to run an executable with the permissions of the executable’s owner or group. They are often used to allow users on a computer system to run programs with temporarily elevated [...]

Linux : How to export public key for others/friends or your recipients

1) Login to your shell account 2) Use –export option to export your public key in text file $ gpg –export –a > my.key OR $ gpg –export -a | mail -s “My key” friend@domain.com Where -a –armor : Create ASCII armored output. –export : Export the key for sharing First command write output to [...]

Shell script to Finding ALL Superuser ( root ) Accounts under UNIX / Linux OSes

In Unix-style computer operating systems, root is the conventional name of the user who has all rights or permissions in all modes (single- or multi-user). The root user can do many things an ordinary user cannot, such as changing the ownership of files and binding to ports numbered below 1024. It is never good practice [...]

Shell script to backup directories from Linux server to Windows 2000/NT Server

#!/bin/bash # Shell script to backup directories from Linux server to Windows 2000/NT Server. # Run it as follows # Scriptname /home backup abc123 //server2000/backup # Backup /home directory from Linux box to NT/2000 box called # ‘server2000′ in share called ‘/backup’ with username # ‘backup’ and password ‘abc123′ # ——————————————————————– # This is a [...]