Archive for the ‘Linux Knowledgebase’ Category

h1

Restoring Default Ubuntu Panel

May 6, 2009

How to restore the default Ubuntu Panel.

This have been tested in Ubuntu 9.04.

Run the following command in terminal.

gconftool –recursive-unset /apps/panel
rm -rf ~/.gconf/apps/panel
pkill gnome-panel

Then logout and then back in.

Source: http://www.saifur-rahman.com/tag/default-panel/

h1

Enable Wireless in Ubuntu 9.04

May 4, 2009

I have a HP 510 laptop with ubuntu 9.04 on it. Everything worked fine until one day when it just lost its wireless connection. When I looked at network manager it say that the device not manage.

After searching the net for a long time without finding a solution I found a website that finely had a solution.

I am a newbie to Ubuntu and Linux so I do not know what it did but it seemed to resolved the problem. The article as written in 2006 for Dapper Drake but is seems to also work on 9.04.

To update the source list run the following command

sudo apt-get

sudo apt-get install wpasupplicant

sudo apt-get install network-manager-gnome network-manager

sudo gedit /etc/network/interfaces

Comment out everything other than “lo” entries in that file and save the file

Create a file called /etc/default/wpasupplicant, add entry ENABLED=0 and save the file

sudo touch /etc/default/wpasupplicant

Reboot your system or use the following command

sudo /etc/init.d/dbus restart

Hope it helps.

Source : http://www.debianadmin.com/enable-wpa-wireless-access-point-in-ubuntu-linux.html

h1

Ubuntu Send Ctrl+Alt+Del command to VMware Server VM

May 4, 2009

I was surprised to find there is not a “send ctrl+alt+del” menu command in VMware Server 2.0. When connecting from an Ubuntu desktop. It’s not in the Remote Console menus nor in the Commands section of the Web Interface. Normally that is not a big deal because you can always use “ctrl+alt+ins” to log on to a Windows VM, but it did not work. I was banging away at my keyboard wondering what was wrong. I had just finished installing Server 2008 remotely from one of my Intrepid desktops and was ready to log back in to run dcpromo but I could not get to the log on prompt. I thought maybe my ins key went bad, but I knew that could not be the case. When I tried to use another Ubuntu desktop I had the same problem. Then I discovered there was not a menu command either! I did some research.

Turns out you have to use the Del key from the number pad on your Ubuntu desktop’s keyboard because the keyboard mappings in Ubuntu 8.10 are not correct! The working key combination is therefore “ctrl+alt+[numberpad]del. If you do not have a number pad on your keyboard (laptops) then make this quick config change.

add just one line to the file ~/.vmware/config:

xkeymap.nokeycodeMap = true

Close the VM web console and reopen it for the change to take effect.

Source :http://vmetc.com/2009/01/30/ubuntu-send-ctrlaltdel-command-to-vmware-server-vm/

h1

How to mount a Windows share with smbmount.

May 1, 2009

Ok so onto the Linux system, its relatively simple:
Make the directory you want to mount the share to.

mkdir /mnt/share

Next either…
Mount the share with user/pass:

smbmount //winpc/shared /mnt/share -o username=user,password=pass,rw

Or mount the share without a user/pass (this is true if Everyone is still set)

smbmount //winpc/shared /mnt/share -o rw

Source :http://www.linux-noob.com/forums/index.php?showtopic=1404

h1

Changing font color of the panel

February 3, 2009

In ~/.gtkrc-2.0 insert this line

include “/home/<user_name>/.gnome2/panel-fontrc”

then create the file panel-fontrc in .gnome2, which consists of the following lines:

style “my_color”
{
fg[NORMAL] = “#4353b6″
}
widget “*PanelWidget*” style “my_color”
widget “*PanelApplet*” style “my_color”

and that’s it. All you have to do is choose the color and do a killall gnome-panel. The second “widget” line affects only the applets and the first one does the rest.
To chose the color you can use the color select dialog in GIMP.

Source: http://ubuntuforums.org/showthread.php?t=66879

h1

Ad blocking with ad server hostnames and IP addresses

May 1, 2008

A list of ad servers and how to use them to easily block 90% of ads on the web.
http://pgl.yoyo.org/adservers/

h1

How can I set the system date and time from the command prompt (bash shell)?

May 1, 2008

Use date command to display the current date and time or set the system date and time over ssh session.
This is useful if the Linux server time and/or date is wrong, and you need to set it to new values from the shell prompt.
Use the following syntax to set new data and time:

date set=”STRING”

For example, set new data to 2 Oct 2006 18:00:00, type the following command as root user:

# date -s “2 OCT 2006 18:00:00″

Source http://www.cyberciti.biz/faq/howto-set-date-time-from-linux-command-prompt/

h1

Server Monitoring With munin And monit On Debian Etch

May 1, 2008
Version 1.0
Author: Falko Timme <ft [at] falkotimme [dot] com>
Last edited 04/24/2007
In this article I will describe how you can monitor your Debian Etch server with munin and monit. munin produces nifty little graphics about nearly every aspect of your server (load average, memory usage, CPU usage, MySQL throughput, eth0 traffic, etc.) without much configuration, whereas monit checks the availability of services like Apache, MySQL, Postfix and takes the appropriate action such as a restart if it finds a service is not behaving as expected. The combination of the two gives you full monitoring: graphics that let you recognize current or upcoming problems (like “We need a bigger server soon, our load average is increasing rapidly.”), and a watchdog that ensures the availability of the monitored services.

Although munin lets you monitor more than one server, we will only discuss the monitoring of the system where it is installed here.

This tutorial was written for Debian Etch, but the configuration should apply to other distributions with little changes as well.

I want to say first that this is not the only way of setting up such a system. There are many ways of achieving this goal but this is the way I take. I do not issue any guarantee that this will work for you!

1 Preliminary Note

Our system’s hostname is server1.example.com, and we have a web site www.example.com on it with the document root /var/www/www.example.com/web.

2 Install And Configure munin

To install munin on Debian Etch, we do this:

apt-get install munin munin-node

Next, we must edit the munin configuration file /etc/munin/munin.conf. We want munin to put its output into the directory /var/www/www.example.com/web/monitoring, therefore we change the value of htmldir, and we want it to use the name server1.example.com instead of localhost.localdomain in the HTML output, therefore we replace localhost.localdomain with server1.example.com. Without the comments, the changed file looks like this:

vi /etc/munin/munin.conf

dbdir   /var/lib/munin htmldir /var/www/www.example.com/web/monitoring logdir  /var/log/munin rundir  /var/run/munin  tmpldir /etc/munin/templates  [server1.example.com]     address 127.0.0.1     use_node_name yes

Next we create the directory /var/www/www.example.com/web/monitoring and change its ownership to the user and group munin, otherwise munin cannot place its output in that directory. Then we restart munin:

mkdir -p /var/www/www.example.com/web/monitoring
chown munin:munin /var/www/www.example.com/web/monitoring
/etc/init.d/munin-node restart

Now wait a few minutes so that munin can produce its first output, and then go to http://www.example.com/monitoring/ in your browser, and you see the first statistics.

3 Password-Protect The munin Output Directory (Optional)

Now it is a good idea to password-protect the directory /var/www/www.example.com/web/monitoring unless you want everybody to be able to see every little statistic about your server.

To do this, we create an .htaccess file in /var/www/www.example.com/web/monitoring:

vi /var/www/www.example.com/web/monitoring/.htaccess

AuthType Basic AuthName "Members Only" AuthUserFile /var/www/www.example.com/.htpasswd <limit GET PUT POST> require valid-user </limit>
Then we must create the password file /var/www/www.example.com/.htpasswd.
We want to log in with the username admin, so we do this:
htpasswd -c /var/www/www.example.com/.htpasswd admin
Enter a password for admin, and you're done!
Source: http://www.howtoforge.com/server_monitoring_with_munin_monit_debian_etch
h1

Keeping your clock current, automatically

May 1, 2008

If you have a system which is doing something important such as handling mail, or running as firewall, it’s essential that you keep the correct date and time. This allows your logs to have the correct timestamps upon them. If you’re collecting logs from multiple hosts time becomes even more important. Having the logfiles with wrong dates and times means that you’ll be comparing entries out of order.

Thankfully there exists a simple protocol for keeping the dates and times of computers connected to a network in sync. It is called NTP, the Network Time Protocol.

There are several packages related to NTP in the Debian archive, probably the simplest is the client ntpdate.

Install it by running, as root, apt-get install ntpdate, and your machine will be automatically setup to sync time from the public servers which have the name pool.ntp.org.

If you wish to change them to point to an internal time server of your own you can adjust this by editting the file /etc/default/ntpdate.

Source: http://www.debian-administration.org/articles/25

h1

Reset Debian Firewall

May 1, 2008

iptables -F INPUT
iptables -P INPUT ACCEPT