Improve Bash Shell Scripts Using Dialog

Linux is based on the Unix operating system, but also features a number of unique and useful kernel features and application programs that often go beyond what is available under Unix. One little-known gem is “dialog”, a utility for creating professional-looking dialog boxes from within shell scripts. This article presents a tutorial introduction to the dialog utility, and shows examples of dialog box.

Linux is based on the Unix operating system, but also features a number of unique and useful kernel features and application programs that often go beyond what is available under Unix. One little-known gem is “dialog”, a utility for creating professional-looking dialog boxes from within shell scripts. This article presents a tutorial introduction to the dialog utility, and shows examples of how and where it can be used.


If you have installed a recent version of the Slackware Linux distribution, you've seen the professional-looking install process; it was created using the dialog utility.

True to the Unix tradition of writing general-purpose tools that work together, dialog allows creating text-based color dialog boxes from any shell script language. It supports eight types of dialogs:

  • yes/no boxes

  • menu boxes

  • input boxes

  • message boxes

  • text boxes

  • info boxes

  • checklist boxes

  • radiolist boxes

Dialog is very easy to use. If you've got your keyboard handy, here's a one-line example of a message box you can try. (Note: The examples in this article assume you are running a Bourne-compatible shell program such as GNU bash.)

% dialog --title 'Message' --msgbox 'Hello, world!' 5 20

This example creates a message box with the title “Message”, containing the greeting “Hello, world!”. The box is 5 lines high and 20 characters wide, with the message nicely centered in the box. An “OK” button appears at the bottom; pressing dismisses the menu.

Dialog Box Types

Most calls to dialog are in a similar format: an optional title, the dialog type, the text to be displayed, and the height and width (in characters) of the dialog box. Additional parameters specific to each menu type follow. Let's have a brief look at each of the available types.

The “yesno” menu is very similar to our first example:

% dialog --title "Message"  --yesno "Are you having\ fun?" 6 25

If you try this example, you will see that there are now two buttons at the bottom, labeled “Yes” and “No”. You can select between the buttons using the cursor keys (or ) and make your selection by pressing . The exit status returned to the shell will be 0 if “Yes” is chosen and 1 if a “No” selection is made.

You may wish to try experimenting with the height and width parameters. If the width is less than the string length, the string is wrapped around (at word boundaries). If you make the dialog box too small, then characters will be lost.

We previously saw the message box. The “infobox” is similar except that it does not wait for the user to select an “OK” button. This is useful for displaying a message while an operation is going on. Here is an example:

% dialog --infobox "Please wait" 10 30 ; sleep 4

The “inputbox” allows a user to enter a string. The usual editing keys can be used, and the text field scrolls if necessary. After the user enters the data, it is written to standard error (or more commonly redirected to a file as in this example):

% dialog --inputbox "Enter your name:" 8 40 2>answer

The “textbox” type is a simple file viewer; it takes a filename as a parameter:

% dialog --textbox /etc/profile 22 70

The usual movement keys work here: the cursor keys, Page Up, Page Down, Home, etc. You can exit by pressing or .

The “menu” type allows creating a menu of choices from which the user can choose. The format is

% dialog --menu   
[]

Each menu entry consists of a “tag” string and an associated “item” string, both of which are displayed. The user can make a choice using the cursor keys and pressing . The selected tag is written to standard error. Here is a simple example:

% dialog --menu "Choose one:" 10 30 3 1 red 2 green\ 3 blue

The next type is the “checklist”. The user is presented with a list of choices and can toggle each one on or off individually using the space bar:

% dialog --checklist "Choose toppings:" 10 40 3 \
1 Cheese on \
2 "Tomato Sauce" on \
3 Anchovies off

The third field in each choice is the initial state; -either “on” or “off”. The last type is the “radiolist”, essentially the same as the checklist except that the user must make one choice from a list of mutually exclusive options. The radiolist type, and the alternate form of title show here, were introduced in version 0.4 of dialog.

% dialog --backtitle "CPU Selection" \
--radiolist "Select CPU type:" 10 40 4 \
1 386SX off \
2 386DX on \
3 486SX off \
4 486DX off
A Real Application

The preceding examples were somewhat unrealistic; dialog is normally used within a shell script to do some real work. Let's look at a simple but useful application. I use the following script to back up my home directory to floppy disk on a regular basis:

#!/bin/sh
# Backup all files under home directory to a single # floppy
# Display message with option to cancel
dialog --title "Backup" --msgbox "Time for backup \ of home directory. \
Insert formatted 3-1/2\" floppy and press \ to start backup or \
to cancel." 10 50
# Return status of non-zero indicates cancel
if [ "$?" != "0" ]
then
dialog --title "Backup" --msgbox "Backup was \ canceled at your
request." 10 50
else
dialog --title "Backup" --infobox "Backup in \ process..." 10 50
cd ~
# Backup using tar; redirect any errors to a
# temporary file
# For multi-disk support, you can use the
# -M option to tar
tar -czf /dev/fd1 . >|/tmp/ERRORS$$ 2>&1
# zero status indicates backup was successful
if [ "$?" = "0" ]
then
dialog --title "Backup" --msgbox "Backup \
completed successfully." 10 50
# Mark script with current date and time
touch ~/.backup
else
# Backup failed, display error log
dialog --title "Backup" --msgbox "Backup failed \ -- Press

to see error log." 10 50
dialog --title "Error Log" --textbox /tmp/ERRORS$$ 22 72
fi
fi
rm -f /tmp/ERRORS$$
clear

To run this automatically, I put these lines in my .profile file to call the backup script on login if more than 3 days has elapsed since the last backup was made:

# do a backup if enough time has elapsed
find ~/.backup -mtime +3 -exec ~/.backup \;
A Longer Example

The sound driver for the Linux kernel uses a program called “configure” to prompt the user for sound configuration options. It generates a C header file based on the chosen options. A replacement based on dialog could offer some advantages, such as a more professional appearance and the ability to select options randomly from menus rather than as a linear sequence of questions.

Due to time and space constraints, I only present a partial (but functional) implementation of a sound driver configuration script. This could quite easily be extended to fully replace the current configure program.

The complete script is shown in as Listing 1. I'd like to explain it using a top down approach, which means reading the listing starting from the bottom.

The last part of the script is a while loop which simply calls the shell function main_menu repeatedly. Above that is the code to implement the main menu. We present the user with three choices, and redirect the selection to a file. One of three shell functions is then called, based on the user's choice.

The most important menu in this script is the next one, the config_menu function. Again we present the user with a number of choices. Note that in this case there is an option which returns the user back to the main menu.

Continuing to read our listing backwards, we come to the select_cards function. The kernel supports multiple sound cards, so here we use a checklist to present the user with the available choices. The command “on_off” is a utility function that will be shown later; it returns the string “on” if its parameters are equal, otherwise it returns “off”. This is the form that the checklist menu requires. Note that the return status of the command is checked. If the user selects “cancel” from the menu then the return status is non-zero and we return immediately without making any changes. Otherwise, we set appropriate variables to indicate which sound cards have been enabled.

The next function, as we read our listing backwards, it the function view_summary. This uses the textbox type to display a file containing information on the currently selected options. We first build up the data in the file before displaying it.

Our next function is select_dma. Here the user must make one of four mutually exclusive options, so we use the a radio list. If you try this example yourself, be aware that the radiolist type was added in dialog version 0.4; if you have an older version then you will have to make do with a checklist.

Availability

Up above, the routine select_irq uses very similar code to allow the user to select the final option in our configuration utility.

The purpose of this script is to generate a C language header file defining the compile options for the kernel sound driver. The “save” function does this. Notice how a dialog box is displayed while the save is in progress.

Above that we see the on_off function alluded to previously. This avoids some repetitive code in the script.

Finally, we see the clean_up routine which allows the user to exit from the script. At the top of the script some default values are defined for the configuration options and the temporary filename to use.

The configuration utility still needs a few enhancements to replace the existing program, including more kernel options and error checking, but the example does function and gives a feel for what can be done with dialog. I encourage you to type it in and try it.

Advanced Features

There are several more things that dialog can do. You can create and use a dialogrc file to customize the color and appearance of the dialog boxes. Dialog also supports displays that do not provide color or graphics characters. The details are given in the man page.

Dialog is “8-bit clean”, meaning that that international character sets other than the standard US ASCII are supported.

More Applications

For some longer examples of using dialog you can look at the sample scripts included with the dialog source code. Under Slackware Linux, the system configuration scripts can be found in /usr/lib/setup.

There are undoubtedly many possible uses for dialog. You could, for example, create a fully menu-driven interface for Linux users not familiar with shell commands. This could even be expanded into a simple bulletin board system that allowed users to read mail and Usenet news, edit files, etc.

The example sound driver script could be expanded into a tool for configuring all of the kernel compile options.

Incidently, dialog is reasonably portable and should run with minimal changes on any Unix-compatible system that has a curses library. It can also be used from any shell script language.

Conclusions

Dialog is a simple yet powerful utility, true to the Unix tradition of making each tool do one thing well. It can add a polished look to your applications and make them easier to use.

Continue reading Improve Bash Shell Scripts Using Dialog

Password protected single user mode

You forget your root password and get locked out of your own box. What do you do? Typically, you would reboot into single user mode and change the password there.

When booting into single user mode you will not be prompted for the root password. This is something every attacker knows and prays on once he has gained physical access to you box. So what do you do?

Firstly, a good sys admin knows not to forget the root password. Login in as root is never a good idea so using sudo is always advised. This still leaves the single user mode vulnerable, to secure it you will have to append the following line “su:S:wait:/sbin/sulogin” to your “/etc/inittab” file. Now, every time you boot into single user mode you will be prompted for the root password.

See sample below,

# password protect single user mode
su:S:wait:/sbin/sulogin

PS: Always remember you password, if you can’t then write in down in a safe place.

Continue reading Password protected single user mode

Overview of VNC

VNC, or Virtual Networked Computing, is a way of controlling a remote computer just as though you are sitting in front of it. In the Windows world it is also known as remote desktop but it's normally referred to as VNC in the Linux world. All that happens is that you connect using a VNC client to a remote computer running the VNC server, then an image of the remote desktop is transmitted to your local computer and you can see and control the desktop just as though you are there since all keyboard and mouse commands are sent from your client machine to the server.

Gnome Remote Desktop

If you are running the Gnome desktop on Fedora Core then you already have a VNC server built in. Click on the Fedora icon > Desktop > Preferences >

Remote Desktop to open the dialog shown.

Gnome remote desktop

The screen is pretty self explanatory but basically when set up this way another computer can connect to your computer using the command listed on the dialog. There are a few important things to note, you must open port 5900 on the server for this to work since by default the Gnome Remote Desktop (called vino) listens on this port, also the person connecting will see the same session that you are currently logged in as. This means that any programs you have open will also be visible to the client, of course this is very useful if you are helping someone remotely.

A more flexible way to use VNC is to install the VNC server and client software via yum, these are rpm's based on RealVNC.

vncserver and vncviewer

Check what's installed

First check if you already have them installed on your system, open a terminal and type:

$ rpm -qa|grep vnc

vnc-server-4.1.1-36

vnc-4.1.1-36

If you get an output something like this then you're all ready, if not you need to install them via yum.

Add a user(s)

Next we need to add at least 1 VNC user, open the file /etc/sysconfig/vncservers as root and add the information shown:

$ vi /etc/sysconfig/vncservers

# The VNCSERVERS variable is a list of display:user pairs.

#

# Uncomment the lines below to start a VNC server on display :2

# as my 'myusername' (adjust this to your own). You will also

# need to set a VNC password; run 'man vncpasswd' to see how

# to do that.

#

# DO NOT RUN THIS SERVICE if your local area network is

# untrusted! For a secure way of using VNC, see

# .

# Use "-nolisten tcp" to prevent X connections to your VNC server via TCP.

# Use "-nohttpd" to prevent web-based VNC clients connecting.

# Use "-localhost" to prevent remote VNC clients connecting except when

# doing so through a secure tunnel. See the "-via" option in the

# `man vncviewer' manual page.

VNCSERVERS="1:bobpeers"

VNCSERVERARGS[1]="-geometry 1024x768 -depth 16"

The important part is the VNCSERVERS="1:bobpeers", this sets up a users for the vnc server, you can add as many as you like here. The VNCSERVERARGS[1] line refers to the arguments for user 1, in this case the only user. Geometry sets the size and depth sets the colour depth, you can adjust these to suit your preferences but in my case the client machine has a resolution of 1024x768 and the depth 16 makes the connection a bit faster since the less information that needs to be sent the more responsive the session will feel.

Knowing which port to use

It's also important to note the session number user as this will tell us which port vncserver will listen on. Remember the Gnome Remote Desktop

asked us to use computername:0 as the connection string, the number needs to be added to 5900 to get the listening port. In this case we need to use

port 5901 since we are using session 1. In the same way we could use any number, for example:

VNCSERVERS="2000:bobpeers"

VNCSERVERARGS[2000]="-geometry 1024x768 -depth 16"

In this case we need to use port 5900+2000 so port 7900.

Setting a password

To add some security we need to add a password that must be given before a connection can be established, open a terminal and type:

$ vncpasswd

Password:

Verify:

This creates a hidden folder called .vnc in your home folder containing the password file.

Starting the server and startup options

To start the server we type the command 'vncserver' and the session you wish to start (if you have set up more than 1 entry in the /etc/sysconfig/vncservers file:

$ vncserver :1

Starting VNC server: 1:bobpeers

New 'linux.bobpeers:1 (bobpeers)' desktop is linux.bobpeers:1

Starting applications specified in /home/bobuser/.vnc/xstartup

Log file is /home/bobuser/.vnc/linux.bobpeers:1.log

[ OK ]

Now the server is started and a user could connect, however they will get a plain grey desktop by default as the connection will not cause a new session of X to start by default, to fix this we need to edit the startup script in the .vnc folder in your home directory.

$ vi ~/.vnc/xstartup

#!/bin/sh

# Uncomment the following two lines for normal desktop:

unset SESSION_MANAGER

exec /etc/X11/xinit/xinitrc

[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup

[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources

xsetroot -solid grey

vncconfig -iconic &

xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" & twm &

As the file says make sure the two lines at the top are uncommented by removing the leading # sign. Next we need to restart vncserver to pick up the changed we just made. To restart the vncserver we need to kill the process and start a new one as root:

$ vncserver -kill :1

Killing Xvnc process ID 13728

$ vncserver :1

Starting VNC server: 1:bobpeers

New 'linux.bobpeers:1 (bobpeers)' desktop is linux.bobpeers:1

Starting applications specified in /home/bobuser/.vnc/xstartup

Log file is /home/bobuser/.vnc/linux.bobpeers:1.log [ OK ]

Using vncviewer

To start the viewer type:

$ vncviewer localhost:5901

This open a dialog as shown for us to enter our password we set earlier, enter the password and you should now see a copy of your desktop.

Note that unlike the Gnome Remote Desktop this has started a new session of X so any applications open on the host machine are not visible to the new session, it's basically a whole new logon running at the same time.

If you just type 'vncviewer' at the prompt then you will asked for the host to connect to, then you can type localhost:5901 for example.

Remember to use the correct port number when connecting, if you set your VNCSERVERS to be 2000:myname then you would need to connect on localhost:7900.

VNCVIEWER logon

Stopping the vncserver

There are two ways to stop the server, either as root:

$ /sbin/service vncserver stop

Shutting down VNC server: 1:bobpeers [ OK ]

or you can explicitly kill a particular session without being root:

$ vncserver -kill :1

Killing Xvnc process ID 13728

Just replace the 1 with the vnc session you wish to stop.

Allowing remote connections

So far we have only connected to our own computer using localhost so we have not needed to open any ports in the firewall, however if we want to allow remote connection we will have to do the following. This can either be done from the command line or using system-config-security if you have it installed.

Using system-config-security to opens ports.

First we'll look into the GUI system-config-security. Go to the Fedora start menu > Desktop > Administration >

Security Level and Firewall, then type your root password when prompted to see this:

system-config-security

Click on other ports at the bottom and enter the port you wish to open, 5901 in my case, select tcp, then click OK and OK again to save your settings. That's all there is to it, but remember to close the port again when you are finished.

Select the port to open

Editing the iptables manually to opens ports.

To do the same from the command line add the line in bold to the file /etc/sysconfig/iptables while logged in as root:

# Firewall configuration written by system-config-securitylevel

# Manual customization of this file is not recommended.

*filter

:INPUT ACCEPT [0:0]

:FORWARD ACCEPT [0:0]

:OUTPUT ACCEPT [0:0]

:RH-Firewall-1-INPUT - [0:0]

-A INPUT -j RH-Firewall-1-INPUT

-A FORWARD -j RH-Firewall-1-INPUT

-A RH-Firewall-1-INPUT -i lo -j ACCEPT

-A RH-Firewall-1-INPUT -p icmp --icmp-type any -j ACCEPT

-A RH-Firewall-1-INPUT -p 50 -j ACCEPT

-A RH-Firewall-1-INPUT -p 51 -j ACCEPT

-A RH-Firewall-1-INPUT -p udp --dport 5353 -d 224.0.0.251 -j ACCEPT

-A RH-Firewall-1-INPUT -p udp -m udp --dport 631 -j ACCEPT

-A RH-Firewall-1-INPUT -p tcp -m tcp --dport 631 -j ACCEPT

-A RH-Firewall-1-INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT

-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 5901 -j ACCEPT

-A RH-Firewall-1-INPUT -j REJECT --reject-with icmp-host-prohibited

COMMIT

Finally we need to restart the iptables service to reload the changes.

$ sudo /sbin/service iptables restart

Flushing firewall rules: [ OK ]

Setting chains to policy ACCEPT: filter [ OK ]

Unloading iptables modules: [ OK ]

Applying iptables firewall rules: [ OK ]

Loading additional iptables modules: ip_conntrack_netbios_n[ OK ]

Connecting from the remote machine.

Now from the remote client computer start up vncviewer but this time use the IP address of the host computer followed by the port number. So on my home network this might be:

$ vncviewer 192.168.1.105:5901

You should see a copy of the hosts desktop, if things seem a bit slow you can try adjusting the colour depth or screen resolution on the vncserver to see if that helps.

Continue reading Overview of VNC

Understanding SMTP error codes


SMTP is responsible for sending out your messages. So if you get SMTP error message, it means your e-mails were not send. It is very important you to understand why this has happened so that you can fix the problem. All SMTP codes consist of three digits, for example, 550, 221, 354, etc. Not all of them mean some type of error. In order to understand how these codes work, you have to know that each digit (the first, the second and the third) have there own meaning.

The first digit tells you if your command was accepted and processed. There are five different values for that:

  1. Mail server has accepted the command, but does not yet take any action. A confirmation message is required.

  2. Mail server has completed the task successfully without errors.

  3. Mail server has understood the request, but requires further information to complete it.

  4. Mail server has encountered a temporary failure. If the command is repeated without any change, it might be
    completed. Try again, it may help!

  5. Mail server has encountered a fatal error. Your request can't be processed.

As you can see, the codes that start with 4 and 5 are the ones that tell you that your message won't be sent until you find and fix the problem.

The second digit tells you more:

  1. Syntax error

  2. Information reply (for example to HELP request)

  3. This digit refers to the status of connection

  4. This digit refers to the status of the mail server

Digits 3 and 4 are not used.

The third (last) digit of the code tells you the details of mail transferring status.

Here is the list of most important SMTP error codes:

421 Service not available, closing transmission channel (This may be a reply to any command if the service knows it must shut down)
450 Requested mail action not taken: mailbox unavailable (E.g., mailbox busy)
451 Requested action aborted: local error in processing
452 Requested action not taken: insufficient system storage
500 Syntax error, command unrecognized (This may include errors such as command line too long)
501 Syntax error in parameters or arguments
502 Command not implemented
503 Bad sequence of commands
504 Command parameter not implemented
550 Requested action not taken: mailbox unavailable (E.g., mailbox not found, no access)
551 User not local; please try
552 Requested mail action aborted: exceeded storage allocation
553 Requested action not taken: mailbox name not allowed (E.g., mailbox syntax incorrect)
554 Transaction failed

The other codes that provide you with helpful information about what's happening with your messages are:

211 System status, or system help reply
214 Help message (Information on how to use the receiver or the meaning of a particular non-standard command; this reply is useful
only to the human user)
220 Service ready
221 Service closing transmission channel
250 Requested mail action okay, completed
251 User not local; will forward to
354 Start mail input; end with . (a dot)

Continue reading Understanding SMTP error codes

Forget your windows XP Password

If you forgot your password on you windows XP here is a simple solution (Guide #1).

1. Restart you computer

2.When booting, press F8 and select "Safe Mode"

3.After getting to the user menu. Click on a user and this time it will not ask you for a password

4.Go to Start>Run and type CMD .

5.At command prompt type in cd C:WindowsSystem32, (Where C put your system's HD letter,I am assuming C is your System/Windows Drive)

6.For safety purposes first make a backup of your Logon.Scr file.. You can do this by typing in Copy Logon.scr Logon.bak

7.Then type copy CMD.EXE Logon.scr

8.Then type this command, I will assume that you want to set Administrator's password to NewPass

9.Now, type this in net user administrator NewPass

10. You will get a message saying that it was successful, this means Administrator's new password is NewPass

11. Restart the PC and you will login as Administrator (or whatever you chose to reset) with your chosen password

Continue reading Forget your windows XP Password

CCM (Cisco Call Manager)

Hi to everyone, i uped in RapidShare a complete collection of CCM (Cisco Call Manager), and I want to Share to all, download quickly because itÒ‘s possible the links die soon.

- Cisco CallManager V4.0:

· CD Disk 1
· CD Disk 2
· Security AGENT AND POLICY (One CD Disk)

- Cisco CallManager V4.1:

· CD Disk 1
· CD Disk 2

- Cisco IP Telephony Server Operatinh System:

· Hardware Detection (One CD Disk)
· Installation and Recovery (Two DVD Disk)
· OS UPGRADE (One CD Disk)

- Downloaded Versions:

· Cisco Call Manager 3.3 Ip Telephony Server (One CD Disk)
· Cisco Callmanager 4.1.3 - CD Disk 1
· Cisco Callmanager 4.1.3 - CD Disk 2


*Files Without Password.
*Size: 10 GB
*Download (96 RapidShare parts):

CODE
http://tinyurl.com/34f6dk
http://tinyurl.com/3dehlp
http://tinyurl.com/39f7n4
http://tinyurl.com/35yb9w
http://tinyurl.com/2qao4r
http://tinyurl.com/2mqxkn
http://tinyurl.com/325gv4
http://tinyurl.com/33ef2o
http://tinyurl.com/2ks6ar
http://tinyurl.com/2loc6s
http://tinyurl.com/36duqf
http://tinyurl.com/37on4x
http://tinyurl.com/38m84g
http://tinyurl.com/36ttce
http://tinyurl.com/3aphw6
http://tinyurl.com/32qvyu
http://tinyurl.com/2s9uj5
http://tinyurl.com/2kbalt
http://tinyurl.com/2t63f6
http://tinyurl.com/392xd2
http://tinyurl.com/2w4m2v
http://tinyurl.com/3739x7
http://tinyurl.com/38ukjd
http://tinyurl.com/2slvcv
http://tinyurl.com/2zrbbo
http://tinyurl.com/2y7hyy
http://tinyurl.com/22wsq3
http://tinyurl.com/223mu2
http://tinyurl.com/2ym3fz
http://tinyurl.com/262wsn
http://tinyurl.com/22z9bj
http://tinyurl.com/2yeqoq
http://tinyurl.com/yons2f
http://tinyurl.com/22awkr
http://tinyurl.com/2gy88q
http://tinyurl.com/ytjau4
http://tinyurl.com/ysn5y3
http://tinyurl.com/yufgq5
http://tinyurl.com/28dje5
http://tinyurl.com/yok6nj
http://tinyurl.com/yqczfl
http://tinyurl.com/ytfmz8
http://tinyurl.com/22lunf
http://tinyurl.com/yubse9
http://tinyurl.com/ynvaza
http://tinyurl.com/ywq3bk
http://tinyurl.com/yorgeb
http://tinyurl.com/2b9dqx
http://tinyurl.com/ytmw9x
http://tinyurl.com/yryeku
http://tinyurl.com/2f8nol
http://tinyurl.com/225h3x
http://tinyurl.com/yrlgk8
http://tinyurl.com/23g9dz
http://tinyurl.com/292xhv
http://tinyurl.com/23ov8p
http://tinyurl.com/29v6dw
http://tinyurl.com/yr6f48
http://tinyurl.com/2a3lvq
http://tinyurl.com/yvkbhd
http://tinyurl.com/258644
http://tinyurl.com/2d6qyd
http://tinyurl.com/2cvj7m
http://tinyurl.com/2xj2u8
http://tinyurl.com/yrre6z
http://tinyurl.com/2hr22b
http://tinyurl.com/2yxmbp
http://tinyurl.com/yr96d5
http://tinyurl.com/2a6d7n
http://tinyurl.com/2crusq
http://tinyurl.com/yo62az
http://tinyurl.com/ypve2k
http://tinyurl.com/267392
http://tinyurl.com/22mcov
http://tinyurl.com/2c6ynh
http://tinyurl.com/2hg3wn
http://tinyurl.com/yodcya
http://tinyurl.com/2x84rk
http://tinyurl.com/ywbvvj
http://tinyurl.com/2y4anl
http://tinyurl.com/yup2ob
http://tinyurl.com/yswnw9
http://tinyurl.com/yqb6b6
http://tinyurl.com/2bxouq
http://tinyurl.com/yptjtm
http://tinyurl.com/29mwk8
http://tinyurl.com/2xs6qv
http://tinyurl.com/2flvyn
http://tinyurl.com/2dxddk
http://tinyurl.com/27nb4e
http://tinyurl.com/2yvmdo
http://tinyurl.com/284uzv
http://tinyurl.com/2fz9mr
http://tinyurl.com/yvotw8
http://tinyurl.com/ytwz76
http://tinyurl.com/2ysyys



In addtion of the before input i add the Cisco Unified Call Manager Ver 5.1 For Linux Install DVD:

*Files Without Password.
*Size: 1,2 GB
*Download (12 RapidShare parts):


CODE
http://tinyurl.com/2z5seq
http://tinyurl.com/yp33gd
http://tinyurl.com/2f2oc6
http://tinyurl.com/2c6uxb
http://tinyurl.com/26xls4
http://tinyurl.com/2esele
http://tinyurl.com/yrvus8
http://tinyurl.com/26f89l
http://tinyurl.com/2y56xf
http://tinyurl.com/yun6p8
http://tinyurl.com/ywfzha
http://tinyurl.com/296h6l



Enjoy to all!, Greetings!!
Continue reading CCM (Cisco Call Manager)

Monitor your HDD use

If you're maintaining a lot of server's with multiple hard-drives you'll need to know how to manage and watch your harddrives. You know it's getting full or needs cleaning before it's too late and your users can't complete their work because they're out of disk-space. Nothing is worse than franticly trying to reclaim disk-space because you ran out of it. This guide will hopefully aide you in a time-savinf manner.

First of all: check the usage of your hard-drive(s)!

Code:

$>df -h
Filesystem                Size      Used     Avail Use% Mounted on
/dev/hda3                 4.4G      3.4G      764M  82% /
/dev/hda1                  14G      4.5G      9.3G  33% /mnt/win32

As you can see my hda3 is at 82%. With the help of scripts you can have this task done at given times, and get an e-mail notification if the percentage of used disk-space reaches a certain threshold.

First we will make a basic bash script that will report if any paritions are over 80%.

Code:

#!/bin/bash
df | egrep "(100%|[89][0-9]%)"

The egrep statement will match any usage between 80% and 100%.

Now let's do this as a timed event:
Type crontab -e to start an empty file where you can add all your cron jobs. (for more info type man 5 crontab)

Now to make a basic cron job that will run everyday at 10p.m..

Code:

0 22 * * * df | egrep "(100%|[89][0-9]%)"

The first number, 0, indicates the minute, the second, 22, is the hour that your job is supposed to run at. The next three *'s are day of month, the month, and day of week respectively.

Finally to have this cron job email you if any of your partition's are filled 80% or more you just add the mail command, like so:

Code:

0 22 * * * df | egrep "(100%|[89][0-9]%)" | mail -s "Warning..." you@emailaddr.com

The -s is for subject and you@emailaddr.com will be replaced by your email address.

Let me know what you think about this guide. If you like it, or if it wasn't useful. Any feedback is greatly encouraged. Thanks

Continue reading Monitor your HDD use

Recover MySQL password

This tutorial is written in two ways. One way is for the compiled MySQL and one for the installed MySQL by RPM [tested only in Fedora]. It's not big deal, but I hope it is accessible also to newbies because the directory's change in both examples.

--------------------
If you compiled MySQL by yourself, go this way:

Maybe you have to change the directory where you installed MySQL (here it's /usr/local/mysql/ ).

1. Gain root access to your Linux system

Code:

[boby@space boby]$ su -
Password:
[root@space root]#

2. First you have to stop the daemon

Code:

[root@space root]# /etc/init.d/mysql.server stop
[root@space root]#

3. You will now start MySQL in safe mode without reading the grant tables with all MySQL database passwords and also you will disable networking. The "safe_mysqld" command will do this trick for you.

Code:

[root@space root]# /usr/local/mysql/bin/safe_mysqld --user=mysql
--skip-grant-tables --skip-networking &
[root@space root]#

4. The "mysqladmin" command can now reset the root password. In this case we are setting it to "newpassword".

Code:

[root@space root]# /usr/local/mysql/bin/mysqladmin -u root flush-privileges
password "newpassword"
[root@space root]#

5. And finally restart the daemon

Code:

[root@space root]# /etc/init.d/mysql.server restart
[root@space root]#

6. You can use now your new root password

Code:

[root@space root]# /usr/local/mysql/bin/mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2 to server version: 4.0.20-standard
 
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
 
mysql>

--------------------
If you installed MySQL by RPM or use the package that comes with the distribution, go this way:

1. Gain root access to your Linux system

Code:

[boby@space boby]$ su -
Password:
[root@space root]#

2. First you have to stop the daemon

Code:

[root@space root]# /etc/init.d/mysqld stop
[root@space root]#

3. You will now start MySQL in safe mode without reading the grant tables with all MySQL database passwords and also you will disable networking. The "safe_mysqld" command will do this trick for you.

Code:

[root@space root]# /usr/bin/safe_mysqld --user=mysql
--socket=/var/lib/mysql/mysql।sock --pid-file=/var/run/mysqld/mysqld।pid
--datadir=/var/lib/MySQL --skip-grant-tables --skip-networking &
[root@space root]#

4. The "mysqladmin" command will now reset[rewrite] the root password. In this case we are setting it to "newpassword".

Code:

[root@space root]# mysqladmin -u root flush-privileges password "newpassword"
[root@space root]#

5. Stop the running daemon

Code:

kill `cat /var/run/mysqld/mysqld.pid`

6. And finally restart it

Code:

[root@space root]# /etc/init.d/mysqld start
[root@space root]#

7. You can use now your new root password

Code:

[root@space root]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2 to server version: 4.0.20-standard
 
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
 
mysql>

--------------------

Hope this helped you!
Please post any mistakes or if I forgot something.

Continue reading Recover MySQL password

GRUB recovery after installing Windows XP

If any one use dual boot system then after installing windows again we lost GRUB loader. It can recover in various method. Here i discuss GRUB recovery using Live cd. For this we have to boot our system by Live cd.

Follow the step to recover grub bootloader:

$ mkdir /mnt/ubuntu
$ mount /dev/sdaX [where X is the number of your linux partition] /mnt/ubuntu
$ mount -t proc none /mnt/ubuntu/proc
$ mount --bind /dev /mnt/ubuntu/dev
$ chroot /mnt/ubuntu
$ grub-install /dev/sda

It works for me…!



Continue reading GRUB recovery after installing Windows XP

EDGE/GPRS in Linux

Using wvdial

to check your mobile/modem as a modem
-------------------------------
#wvdialconf

it will generate /etc/wvdial.conf file for you.

Grameen Phone
For Grameen Phone your need to add
Init3 = AT+CGDCONT=1,"IP","gpinternet"
here is a sample of my /etc/wvdial.conf (Grameen Phone EDGE/GPRS)
------------------------------------------------------------
[Dialer Defaults]
Init1 = ATZ
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Init3 = AT+CGDCONT=1,"IP","gpinternet"
Modem Type = Analog Modem
ISDN = 0
Phone = *99***1#
Modem = /dev/ttyUSB0
Username = xyz
Password = xyz
Baud = 115200
-----------------------------------------------------------
wvdialconf will generate the modem speed/Baud and /dev/xyz path according to your mobile phone


Aktel, Teletalk
here is a sample of my /etc/wvdial.conf
------------------------------------------------------------
[Dialer Defaults]
Init1 = ATZ
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Modem Type = Analog Modem
ISDN = 0
Phone = *99***1#
Modem = /dev/ttyUSB0
Username = xyz
Password = xyz
Baud = 115200
-----------------------------------------------------------
wvdialconf will generate the modem speed/Baud and /dev/xyz path according to your mobile phone

Start
To start type wvdial in shell

Note:
If you have problem while generating wvdial.conf file in /etc/wvdial.conf then delete the old config file /etc/wvdial.conf and give wvdialconf to create a new configuraton file.

if you have any problem to find the /dev path for your mobile/modem, give
# tail -f /var/log/syslog
Then connect the phone/modem.
You can also use gnome-ppp or other ppp tools to connect.




Using gnome-ppp



Give phone number *99***1#




click on the detect. it will try to detect your phone/modem.
note: If it fails then give your /dev path manually. Search for you modem using #tail -f /var/log/syslog then connect the phone/modem.




it found my phone/modem in /dev/ttyUSB0




click Init Strings.
for Aktel, Teletalk and others (you do not need to change anything)




click Init Strings.
add Init3 only if you are using Grameen Phone EDGE/GPRS (only for GP)





after click connect








connected




details view


Note: If you face any problem using this as user. Run gnome-ppp as root
or check you are a member of dip group.

In
Debian or Ubuntu based distro give #adduser your_user_name dip if your are not a member.
Continue reading EDGE/GPRS in Linux