Centos – Create an FTP yum repository with out user authentication for your private Network

Create a YUM repo that retrieves files from an VSFTP server. This tutorial is closely tied to the tutorial that shows how to create a YUM repository using Apache, which is located here. In this how to the same repository directory will be used that Apache is using but we will also make it available via VSFTP. Reason being is that there is no need to have double copies of the same files on the same server.

Setup your YUM Repo Server

1) Install VSFTP

yum install vsftpd

2) Create your YUM directory 

mkdir /var/ftp/ftp_repo

3) Mount the contents of your YUM repository that Apache servers to this newly directory

mount --bind /storage/Centos06/centos/ /var/ftp/ftp_repo/

4) Allow user root to access the ftp directory by uncommenting out the user root

vi /etc/vsftpd/user_list

5) Start your VSFTPd Service

service vsftpd start

Make sure that your firewall will allow FTP connections.

Setup your client machine

1) Create your new repo file

vi /etc/yum.repos.d/ftp.repo

2) Add the following entries



Run yum repolist in order to see YUM sees your new repo. Then run yum update in order to make sure it can login to the FTP server.

Share Button

BASH – Script that reports failed SSH connections

It will scan for servers in the network you specified and detect which servers have the SSH port open thus avoiding any non SSH running servers such as Windows (saves a huge amount of time).  In other words you can only SSH to a server by actually typing your password.

The script assumes that ssh passwordless access is not setup. In order for this to work you will need to install the sshpass utility found in the EPEL yum repository and also have nmap installed.  The script will only report on which servers a specific username failed to connect.


#It is useless to scan host ".1" and ".255". In fact it is borderline dangerous to scan 255 because the router will broadcast the command on all servers which will lead to a lot of traffic 
nmap_network=`nmap -n -P0 -p22 | grep Interesting | awk '{print $4}' | awk -F: '{print $1}'`

for loop in $nmap_network;
/usr/bin/sshpass -p $ADMINPASS ssh -oStrictHostKeyChecking=no -oCheckHostIP=no -t $ADMINLOGIN@$loop exit;
if [[ $? -gt 0 ]];
echo "Failed to connecit to server "$loop"" >> SSH_failure
echo "Success on $loop";
echo "Here are the servers user name $ADMINLOGIN cannot login"
for loop in `awk '{print $6}' SSH_failure`; do nslookup $loop | grep name | awk '{print$4}'; done;
Share Button

CentOS – KickStart File command

Below is a simple example of the KickStart command that can be used to do an install via a Kickstart file that is located on an accessible Web Site.

linux ks=http://172.168.1.xx/ks/KickStartFile.cfg "enter_the_appropriate_cfg_file" ksdev=eth0 ip="IP_of_the_server" netmask= DNS="DNS machine is pointing to"

EXAMPLE: The command below will do an install on the server the command will run on:

linux ks=http://172.168.1.xx/ks/KickStartFile.cfg ksdev=eth0 ip= netmask= DNS=
Share Button

BASH – Generic Linux report scripts.

These scripts are generic reporting scripts that provide general information regarding CPU-Filesystem-RAM usage, uptime, detection if the server is a VMware server or not, Version of Operating System, active TCP sockets and more. These scripts can entered in a for loop and run on multiple servers in order to get an overall picture of the servers.

Continue reading

Share Button

BASH – Script that distinguishes between a Database Server and a Web Server and does service checks.

The script can be used in a for loop. It generates an Error Alarm only when a critical condition is at hand. These specific conditions are as follows. The script can detect if the server is running Apache or PostgreSQL. So if for example it sees that Apache is not installed it will not do a check for the Apache process. It will move on to do a check for PostgreSQL and perform the same check as mentioned above. In other words the script is not blindly checking for processes.

If Apache is down.
If PostgreSQL is down.
If CPU load exceeds normal levels
If the root partition has reached 90% usage
If /storage (other specific directory of your choosing) has reached 90% usage.

Continue reading

Share Button

Python – Reference point script for services and default ports.

This is really my first Python Script. It is meant more as an exersice for me to learn Python. It uses a dictionary that stores services and default ports being used. This is really a useless script 🙂

Continue reading

Share Button

Centos 6.5 – Create a YUM repository for your private network.

This tutorial shows how to create a YUM repository which you can use on your own private network. You may want this if you do not want your production servers to reach on the Internet thus keeping them protected. These servers will get their RPM packages by a server that holds the always up to date RPM packages. This is called the repository server and it will need access to the Internet in order to get the latest RPM packages.



1) Find an official CentOS site that supports RSYNC. List of Links here.

2) Have a spare server to use as your Repo server. This server will need to have Apache installed.

3) Enter an DNS entry for the local web site you will create that will host the RPM packages.

4) Setup yum on your servers to get the new packages from your Repo Server.

Continue reading

Share Button

Centos 6.5 – Add a local repo in 5 small steps

You can set yum to draw RPM packages for install directly from your DVD drive by executing the following steps.

  • 1) Enable yum to read from your local DVD.

                              vi /etc/yum.repos.d/CentOS-Media.repo

  • 2) Set the parameter enabled to 1
  • 3) Create a directory to use as a mount point for your DVD.

                             mkdir /media/cdrom

  • 4) Mount your DVD drive.

                             mount -t iso9660 /dev/cdrom /media/cdrom

  • 5) Install software

                            yum –enablerepo=c6-media install httpd



Share Button

Centos 6-5: Install postgreSQL-9.3 via yum and enable pgcrypto

The commands were taken from the official postgreSQL web site.


I just put the commands together. Very easy to install and start. These commands will install postgreSQL 9.3 and all the packages that come with it. It also initializes the database under /var/lib/pgsql/9.3 and it will also setup the database to start automatically upon startup.

Continue reading

Share Button

Bash: Checks if a Web Site is up and running

This script check if a web site is up and running. It uses curl and check the return status code when it reaches a web site.

URL="http://www.google.com   http://www.lolercakeIdontexist.lol"
for web_loop in $URL;
curl -L --head -w %{http_code} $web_loop -o /dev/null
if [ $? -gt 0 ]
mailx -s "CRITICAL Web Site $web_loop Cannot be reached" your_email_here < some_file_with_custom_text

Share Button