Summer Nights

Let's make the world a better place using digital technologies!

SyncToy to Synchronize

If you want to regularly backup your data from one location/hard-disk to another location/hard-disk on your windows-based computer, then SyncToy is very good candidate to accomplish this. It is a small utility from Microsoft in which you can easily create folder-pairs to synchronize. A number of actions, like merge, subscribe, echo, etc. are available that can be executed on a given pair.

The utility can be freely downloaded from here.

The desired sync operations can also be scheduled via Windows’ task scheduler. Simply look in the SyncToy help to find out.

Continue Reading

WARNING: mysqlcheck has found corrupt tables

If you receive this e-mail from your system, issuing the following command would fix the corrupted tables:

mysqlcheck --user=[username] --password=[pwd] --repair -A

Continue Reading

Use fail2ban to stop brute-force attacks

apt-get install fail2ban
That’s all it takes to install this handy utility. It will monitor different services (ssh, postfix, courier, etc.) for repeated failed login attempts and will block the attacker for a given duration of time. All the settings can be found in /etc/fail2ban/jail.conf.
After you have updated the settings file, use:
/etc/init.d/fail2ban restart
to reload the new settings.

I was having brute-force dictionary attacks on pop3 port, fail2ban blocked the attacker within 1 minute. Thanks to the developers.

Continue Reading

Some Useful MySQL Commands

  • mysql -uusername -ppassword
    gets you into MySQL shell
  • show databases;
    shows all the databases;
  • create database databasename;
    creates a new database
  • grant all privileges on databasename.* to 'user'@'localhost' identified by 'password';
    creates user with password with all privileges on given database
  • use databasename;
    selects a database for further actions
  • show tables;
    displays the tables in the selected database
  • drop database databasename;
    deletes all tables in databasename and deletes the database.
  • select * from mysql.user;
    lists all the mysql users
  • drop user xxxx@localhost;
    deletes the xxxx user from the localhost
  • mysqldump --all-databases -p | bzip2 -c > databasebackup.sql.bz2
    dumps all mysql data in the compressed databasebackup.sql.bz2 file.
  • mysqldump -uroot -p databasename | bzip2 -c > databasename.sql.bz2
    dumps databasename database in the compressed databasename.sql.bz2 file.
Continue Reading