Showing posts with label Ubuntu. Show all posts
Showing posts with label Ubuntu. Show all posts

6 Sept 2011

How to set or change root password in mysql server

A very important step in a database configuration, and many times forgotten, is the setup of a root password. This easy procedure will increase the security for your databases, even if you're only using a personal server on your laptop there is always a chance for an intruder to get sensible data.



In a shell we use the mysqladmin command to achieve this as follows for a local database server:
mysqladmin -u root password "the_new_password"
 Or a remote one:
mysqladmin -u root -h host_name password "the_new_password"
Next you should restart the database server, to make sure the new security settings are used.
sudo /etc/init.d/mysql restart

7 Jun 2011

Stop ssh attacks with fail2ban in CentOS

Every server on the web is subject to frequent breaking attempts, and when there are services running on default ports like 22 for ssh it becomes even more common.

However, using a simple tool freely available called fail2ban we can easily keep those intruders out of our machines without having to change our service ports.

In order to get fail2ban working on a CentOS machine you just have to install it straight from the repositories using:

$ yum install fail2ban


And then edit the configuration file to activate ssh and adjust some key parameters.

#edit configuration using your favourite editor ( I like vi )
$ vi /etc/fail2ban/jail.conf 

To activate ssh access monitorization find [ssh-iptables] section and make it active
enabled  = true
and  point the script to the right log file
logpath  = /var/log/secure

Then you might want to change the following aditional parameters:

  • ignoreip - A comma separated list of IPs you consider safe and would like the script to ignore regarding access attempts (this comes in the top of the configuration file)
  • action - Change the sender and recipient emails to get notifications regarding fail2ban actions
  • maxretry - The maximum number of failed login attempts before an IP get banned
Now just restart the service
/etc/init.d/fail2ban restart
and test it. Just make sure you do not get locked out. Anyway, the ban will be released after 10 minutes (default value).


[UPDATE] Forgot to let you know that if you are using Ubuntu you can also install fail2ban from the repositories and it works straight out of the box with no additional configurations required:
$ sudo apt-get install fail2ban

23 Jul 2010

VirtualBox fails to start on Ubuntu 10.04

Everytime I try to start a Virtual Machine (VM ) using VirtualBox in Ubuntu (right now I'm using Ubuntu 10.04 - Lucid Lynx ) I get an error as follows:

Failed to start the virtual machine UbuntuServer_9.10_32b.
VirtualBox can't operate in VMX root mode. Please disable the KVM kernel extension, recompile your kernel and reboot (VERR_VMX_IN_VMX_ROOT_MODE).


With these details:



Result Code: NS_ERROR_FAILURE (0x80004005)
Component: Console
Interface: IConsole {6375231a-c17c-464b-92cb-ae9e128d71c3}


To solve this We have to disable KVM modules using the following commands:


sudo rmmod kvm_intel
sudo rmmod kvm


Now the VM starts without any problem.
Enhanced by Zemanta

20 Dec 2009

Disk space disappearing

Suddenly I started to get low disk space warnings on the EXT4 partition mounted as / with no apparent reason.
I assumed it was some problem with EXT4 as I was sure nothing could fill the 10Gb I had free the previous day...
I started by using Disk Usage Analyzer trying to find out where all the space was going but found nothing... the space seemed to just disappear with no content. Using fsck to check the partition for errors was not helpful also.
Then I found this wonderful guide about 'Disk Space Problems & Solutions' which led me to find out the problem was with 'Simple Backup' trying to make the backup to the wrong place.
This happened because the backup started without the external drive mounted and so it created the path where the drive was supposed to be mounted and created the backup there. The next time the drive was mounted the mount point was taken by the backup so it mounted on a different location and the subsequent backups were stored on the laptop drive, eating GBs of drive space every day.
For more solutions to similar problems check Ubuntu Forums

25 Nov 2009

Solved mouse click problem in Eclipse and Ubuntu 9.10

Since last October, when I installed Ubuntu 9.10 I started having some problems with mouse clicks in Eclipse.
Using my friend Google I found this solution which proved to work flawlessly.

I created an eclipse.sh with this content:

#!/bin/sh
export GDK_NATIVE_WINDOWS=1
/eclipse


Now I use eclipse.sh instead of just eclipse to start the IDE and mouse click problems are gone.

23 Nov 2009

Kernel update broke NVidia driver

I just installed a new Kernel version (2.6.31-15) using a deb package and then rebooted, just to discover that the GDM would not start and I couldn't even log into the shell on tty1 because it kept flickering, trying to come up with X, I guess...

Then I restarted the machine and selected 'recover mode' on grub screen, to check the logs and find out what the problem was.

Removing xorg.conf from /etc/X11 and then rebooting brought me back X but without Nvidia drivers so I went to System/Administration/Hardware Drivers and tried to activate but nothing happened.

After some research I found out that the new kernel could not load the NVidia drivers because it didn't have the kernel headers needed by the driver.

To solve that I went to tty1, stopped X:
sudo service gdm stop

And then installed the kernel headers as follows:

sudo apt-get install linux-headers-2.6.31-15-generic

Rebooted and everything was back on track.

2 Nov 2009

Installing Flash Player 10 for 64-bit Linux

Although Adobe says this is not a final version, it is already available and ready to be used by those with linux 64bit, avoiding the need for nspluginwrapper to get Adobe Flash Player to work.

I just tested it under Ubuntu 9.10 ( Karmic Koala ) 64bits and it worked much better than it's 32bit alternative. After the upgrade, clean install in fact, to the new Ubuntu release I started to get many problems with Flash Player, including but not limited to clicks not being detected by the flash applications.

This 64bit Linux version is said to become final with the next major release of Flash Player, along with 64bit versions for Windows and Macintosh. In the meantime Adobe's FAQs state that it has been tested to work with Firefox 3 on Ubuntu 8 ( I state it works in Ubuntu 9.10 ) and OpenSUSE 11.

Now the installation details...

Download the pre-release Flash Player distribution from Adobe page:

http://labs.adobe.com/downloads/flashplayer10.html

Then unpack the file contents and copy the library to mozilla plugins directory as follows:

sudo tar xzf libflashplayer*
sudo cp libflashplayer.so /usr/lib/mozilla/plugins/


Clean up the downloaded files which are no longer needed:

rm libflashplayer*

And we are ready to give it a try.

23 Jan 2009

How to record and playback UI macros in Ubuntu using GNU Xnee

There is a nice software that allows anyone to record and playback mouse or keyboard events in Linux.
Here are some guidelines to get you started using it on Ubuntu, which seems to provide only the command line version 'cnee'.

Install the software:
# sudo apt-get install cnee

Record 500 mouse events to a file (events1.xnr) after a delay of 5 seconds:
# cnee --record -o events1.xnr --mouse --events-to-record 500 --time 5

Playback the recorded events after a delay of 3 seconds:
# cnee --replay -f events1.xnr --time 3

For more information visit:
http://www.sandklef.com/xnee/

1 Jul 2008

Creating a new user in Ubuntu command line

This is just a quick tutorial on how to create a new user using shell commands in Ubuntu (similar to any other linux system).

First create the user and it's home directory inside /home directory:

# sudo useradd -d /home/<newusername> -m <newusername>

Then set it's password:

# sudo passwd <newusername>

Now you can try the newly created user account like this:

# su <newusername>