blog.up-link.ro
30Mar/100

How To Backup MySQL databases using a shell script

MySQL is one of the most popular open source database management system for the development of interactive websites.

If your server stores its sensitive data in a MySQL database, you will most definitely want to backup that information so that it can be restored in case of any disaster.

Below is a backup script for MySQL databases (please make sure you will change MYSQL_PASS):

#!/bin/sh
# backup mysql databases shell script
# UNIX LINUX BSD
# by Adi https://blog.up-link.ro
# March 2010

DATE=$(date +%Y-%m-%d)
MYSQL=$(which mysql)
MYSQLDUMP=$(which mysqldump)
MYSQL_USER="root"
MYSQL_PASS="password"
HOSTNAME=$(hostname)
GZIP=$(which gzip)
ARG="-u $MYSQL_USER -p$MYSQL_PASS"
DATABASES=$($MYSQL $ARG -s -e "SHOW DATABASES;")
BACKUP_PATH="/home/backup/$DATE/mysql"

! [ -d $BACKUP_PATH ] && mkdir -p $BACKUP_PATH

for DB in $DATABASES
do
BACKUP_FILE="$BACKUP_PATH/$HOSTNAME-mysql-$DB-$DATE.sql.gz"
$MYSQLDUMP $ARG $DB | $GZIP -9 > $BACKUP_FILE
done

Download the script from here.

Print This Post Print This Post
28Mar/100

FreeBSD: How To Install FreeBSD – FreeBSD 8 Installation Guide

This article is a guide to install FreeBSD 8 using an installation CD/DVD, please make sure you've got a FreeBSD 8 installation CD/DVD.

1.Starting the FreeBSD installation

Start the installation by booting up using the installation disc.

FreeBSD Installation Screenshot 1

FreeBSD Installation Screenshot 1

Press ENTER, the system will start hardware probe process and you will see lots of text messages flying by your screen.
Once the installer has booted up it'll ask you to select the country, system console keymap and the type of installation you want to run. You can use the UP/DOWN arrow key to select and ENTER to continue.

Print This Post Print This Post
28Mar/100

“Smart” meters have security holes

SAN FRANCISCO — Computer-security researchers say new "smart" meters that are designed to help deliver electricity more efficiently also have flaws that could let hackers tamper with the power grid in previously impossible ways.

At the very least, the vulnerabilities open the door for attackers to jack up strangers' power bills. These flaws also could get hackers a key step closer to exploiting one of the most dangerous capabilities of the new technology, which is the ability to remotely turn someone else's power on and off.

Read more directly from the source.

Print This Post Print This Post
26Mar/100

How To Configure NTP Service in FreeBSD

The Network Time Protocol (NTP) is a protocol for synchronizing the clocks of computer systems over packet-switched, variable-latency data networks.

If you only wish to synchronize your clock when the machine boots up, you can use ntpdate. This may be appropriate for some desktop machines which are frequently rebooted, but for servers you should run ntpd.

1. Clock Synchronization using ntpdate

Using ntpdate at boot time is also a good idea for machines that run ntpd. The ntpd program changes the clock gradually, whereas ntpdate sets the clock, no matter how great the difference between a machine's current clock setting and the correct time.

Print This Post Print This Post
26Mar/100

China’s Great Firewall spreads overseas

A networking error has caused computers in Chile and the U.S. to come under the control of the Great Firewall of China, redirecting Facebook, Twitter, and YouTube users to Chinese servers.

Security experts are not sure exactly how this happened, but it appears that at least one ISP recently began fetching high-level DNS (domain name server) information from what's known as a root DNS server, based in China. That server, operated out of China by Swedish service provider Netnod, returned DNS information intended for Chinese users, effectively spreading China's network censorship overseas. China tightly controls access to a number of Web sites, using technology known colloquially as the Great Firewall of China. 

Read more directly from the source.

Print This Post Print This Post
25Mar/100

How To keep ports collection up to date in FreeBSD

The FreeBSD Ports collection is a package management system for FreeBSD which provides an easy way of installing software packages on the FreeBSD operating system.

1. Updating the ports collection

a.) Using CVSup method

This is a quick method of getting and keeping your ports collection up to date using cvsup protocol. Make sure /usr/ports is empty before you run cvsup for the first time.

If you never updated ports collection you have to install cvsup utility:

# pkg_add -r cvsup-without-gui

Update ports collection:

# cvsup -L 2 -h cvsup.freebsd.org /usr/share/examples/cvsup/ports-supfile

Above step will take some time to fetch the files.

b.) Using portsnap method

Portsnap is an alternative system for distributing the ports collection.

Install portsnap with the following command:

# pkg_add -r portsnap

Print This Post Print This Post
25Mar/100

How To Set Up a NFS Server in FreeBSD

Network File System (NFS) is a network file system protocol originally developed by Sun Microsystems in 1984, allowing a user on a client computer to access files over a network in a manner similar to how local storage is accessed.

1. Setting up a NFS Server

The first step to setting up a NFS server is to edit the /etc/rc.conf file and add the following lines:

nfs_server_enable="YES"
nfs_server_flags="-u -t -n 4"
rpcbind_enable="YES"
mountd_flags="-r"
mountd_enable="YES"

Next, you have to set up /etc/exports file to define which machines have permission to which folders.  The exports file looks something like this:

/data -maproot=user1 host1 host2 host3
/backup -alldirs host1 host2 host3
/store host2

In this example the machines host1,host2 and host3 are given the privileges of the user1 for the /data directory.

For /backup they are given access to read from all directories within backup. And for /store only host2 is given access to read just the /store directory (make sure you replace hosts with your desired host names).

To start NFS server, enter:

rpcbind
nfsd -u -t -n 4
mountd -r

2. Restarting the NFS Server

Once you have made changes to the exports file you need to restart NFS for the changes to take effect:

kill -HUP `cat /var/run/mountd.pid`
Print This Post Print This Post
24Mar/100

How To Reset MySQL Password

1. Stop MySQL server

# /usr/local/etc/rc.d/mysql-server stop

2. Start MySQL server  with skip grant table mode

# mysqld_safe –skip-grant-tables &
Output:
[1] 5187
# Starting mysqld daemon with databases from /var/db/mysql

3. Login as user root without password

# mysql -u root -p

Print This Post Print This Post
24Mar/100

How To Reset Keyring Password in Ubuntu

GNOME Keyring is a daemon application designed to take care of the user's security credentials, such as user names and passwords. The sensitive data is encrypted and stored in a keyring file in the users home folder. The default keyring uses the login password for encryption, so users don't need to remember yet another password.
In order to reset the password for Keyring, you will have to delete the keyring files and then start from scratch entering all your password
# rm ~/.gnome2/keyrings/*.keyring
You should be greeted by this prompt when you try

Print This Post Print This Post
24Mar/100

Google Wins European Trademark Victory

A European court ruled this week that allowing Google advertising customers to use the names of other companies as search keywords does not represent a trademark violation.

Google has not infringed on trademarks by allowing these keywords, and Google's AdWords program is protected by a European law governing Internet hosting services, according to a Tuesday decision from the European Court of Justice.

Read more directly from source.

Print This Post Print This Post