Monthly Archives: May 2008

PulseAudio and 5.1 surround sound on Hardy Heron

The new Ubuntu 8.04 look very good and has many improvements over the older releases. I will not discuss about them now. I’ll just stick on the new default sound server, PulseAudio that offers sophisticated mixing capabilities and network transparency.
The purpose of this post is to help other Ubuntu users to enable 5.1 surround sound on their computers, using PulseAudio (you must have a 5.1 capable sound card).
I have a Creative Labs SB Audigy sound card but I tested this solution on a Creative Labs SB Live!. The results were the same in both cases.
The solution is very simple. Run this in your terminal:

sudo joe /etc/pulse/daemon.conf

Uncomment the line containing:

default-sample-channels = 2

and replace '2' with '6' (if you have a 7.1 card, replace '2' with '8')
Restart the window manager and enjoy the new sound!

Reset the root password on MySQL

Have you ever forgotten the root password on one of your MySQL servers?
This is a quick h00tow (how to) reset your MySQL root password. It does require root access on your server.

First things first. Log in as root and stop the mysql daemon. Now lets start up the mysql daemon and skip the grant tables which store the passwords.
mysqld_safe --skip-grant-tables
You should see mysqld start up successfully. If not, well you have bigger issues. Now you should be able to connect to mysql without a password.
mysql --user=root mysql

update user set Password=PASSWORD('YourNewRootPassword');
flush privileges;
exit;

If you are using Ubuntu 8.04 Hardy Heron, when you try to restart the mysql service using
sudo /etc/init.d/mysql restart
you’ll get an error like

error: 'Access denied for user 'debian-sys-maint'@'localhost' (using password: YES)'

The debian_sys_maint user is the one used by mysql user system under debian sytems.In order to fix this (seeming to be a grant error) do like this:

Save the password of debian-sys-maint user which is localized in /etc/mysql/debian.cnf file (readable only by root):


sudo more /etc/mysql/debian.cnf
# Automatically generated for Debian scripts. DO NOT TOUCH!
[client]
host = localhost
user = debian-sys-maint
password = lP3Ufasdas3AVm7EdC
socket = /var/run/mysqld/mysqld.sock
[mysql_upgrade]
user = debian-sys-maint
password = lP3Ufasdas3AVm7EdC
socket = /var/run/mysqld/mysqld.sock
basedir = /usr
root@scrat:/etc/mysql#

Save somewhere this password, then connect on mysql under root:
mysql -u root -p

and execute following command:

GRANT ALL PRIVILEGES ON *.* TO ‘debian-sys-maint’@'localhost’
IDENTIFIED BY ‘your_password’ WITH GRANT OPTION;

Everything should be OK now.

There is another method to reset the root password on MySQL in Ubuntu:
sudo /etc/init.d/mysql reset-password

Sample firewall script for Hardy Heron

I just thought that you might be interested in a small script you can use in Hardy Heron.

It uses the new UFW (Uncomplicated firewall) introduced in this new Ubuntu distro.

The script is well commented, so everything is easy to understand.

Here is the script:

#!/bin/bash
 
  ## set the default policy to drop (deny) all connections
  sudo ufw default deny
 
  ## set logging ON
  sudo ufw logging on
 
  ## permit unrestricted traffic from a specific static IP address
  sudo ufw allow from 192.168.1.1    # maybe your router
 
  ## permit TCP connections on ssh port 22
  sudo ufw allow 22/tcp
 
  ## Allow Apache2
  sudo ufw allow 80/tcp
 
  ## Allow MySQL
  sudo ufw allow 3306/tcp
 
  ## Allow Bittorrent
  for port in {7881..7889};
  do sudo ufw allow $port/tcp; done
 
  ## Allow eMule
  sudo ufw allow 4662/tcp
  sudo ufw allow 4672/udp
 
  ## Allow DC++
  sudo ufw allow 6845
 
  ## Allow Samba from internal network only 
  sudo ufw allow proto tcp from 192.168.1.0/24 to any port 135 # used by smbd
  sudo ufw allow proto udp from 192.168.1.0/24 to any port 137 # used by nmbd
  sudo ufw allow proto udp from 192.168.1.0/24 to any port 138 # used by nmbd
  sudo ufw allow proto tcp from 192.168.1.0/24 to any port 139 # used by smbd
  sudo ufw allow proto tcp from 192.168.1.0/24 to any port 445 # used by smbd
 
  ## Display rules
  sudo ufw status

You can modify it by adding/removing rules accordingly.

Backup your MySQL databases automatically with AutoMySQLBackup

If you are a MySQL user and you want to have a disaster recovery solution, or even as a simple backup, you can write small shell scripts based on mysqldump tool.

For this, you need AutoMySQLBackup. It doesn’t have any real requirements (mysqldump of course is needed – in any mysql client package – and gzip or bzip2 to compress the resulting file) and has all the features I was looking for in such a script.

AutoMySQLBackup has all the features I needed: it can backup a single database, multiple databases, or all the databases on the server; each database is saved in a separate file that can be compressed (with gzip or bzip2); it will rotate the backups and not keep them filling your hard drive (as normal in the daily backup you will have only the last 7 days of backups, the weekly if enabled will have one for each week, etc.). It has also some other features (check the project homepage for full details), that I am not using myself (like email logs for example), but other peoples might find interesting.

All you have to do is to modify a few things:

# Username to access the MySQL server e.g. dbuser
USERNAME=dbuser
# Username to access the MySQL server e.g. password
PASSWORD=password
# Host name (or IP address) of MySQL server e.g localhost
DBHOST=localhost
# List of DBNAMES for Daily/Weekly Backup e.g. "DB1 DB2 DB3"
DBNAMES="all"
# Backup directory location e.g /backups
BACKUPDIR="/var/backup/mysql"
# Mail setup
MAILCONTENT="quiet"

You can run the script manually but you will want to enable it in cron
and run daily.

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

Close