Linux

Execute commands on multiple hosts using ssh

#!/bin/bash # Linux/UNIX box with ssh key based login SERVERS=”192.168.1.1 192.168.1.2 192.168.1.3″ # SSH User name USR=”jadmin” # Email SUBJECT=”Server user login report” EMAIL=”admin@somewhere.com” EMAILMESSAGE=”/tmp/emailmessage.txt” # create new file >$EMAILMESSAGE # connect each host and pull up user listing for host in $SERVERS do echo “——————————–” >>$EMAILMESSAGE echo “* HOST: $host ” >>$EMAILMESSAGE echo “——————————–” […]

Read More
Linux

wget the ultimate command line downloader

However, when it comes to command line (shell prompt) wget the non-interactive downloader rules. It supports http, ftp, https protocols along with authentication facility, and tons of options. Here are some tips to get most out of it: Download a single file using wget $ wget http://www.cyberciti.biz/here/lsst.tar.gz $ wget ftp://ftp.freebsd.org/pub/sys.tar.gz Download multiple files on command […]

Read More
Security

Port Knocking

What is Port Knocking? Port knocking is a method by which you can dynamically open ports on your server to a single IP address. Port knocking allows you to transparently run a service on your server without exposing the services of that port to all IP addresses. In practice, it is very similar to having […]

Read More
Linux

MySQL Not Listening On A Public IP

By default, MySQL (on Debian) doesn’t listen on the public interface: #netstat -l tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN 1768/mysqld In /etc/mysql/my.cnf, comment out the bind line: #bind-address = 127.0.0.1 And restart MySQL. Then it will listen on the public interface, and you should be able to connect. #netstat -l tcp 0 0 0.0.0.0:3306 0.0.0.0:* […]

Read More