Thursday, September 27, 2012

Just One Desire : And You Touch the Sky….

We often say that in the way of the life we come across some situations which inspire us and give a changing point to our life.
One such good incident which inspired me was, recently I read about a guy named Pratish Datta of Kolkata. Pratish is a 23 years boy who is the student of IIT-KHARAGPUR. Hearing name IIT what comes in our mind? Our dream institutes….right? We often get jealous about IITians? Don’t we? Pratish have lost his vision in one eye at his poor age of 6 months. His family (mother: house-wife and father: renowned civil engineer of Kolkata) were worried about his future. In his childhood his mom guided him with his lessons of school. He use to do sums of math’s mentally. For him “practice made him perfect in mental math’s”. With support of his parents he passed his schooling with flying colors. Next his dream was to get admitted in one of the most famous institutes which everyone dreams to go i.e. IIT. He mother fully supported his and left Kolkata for him and shifted to Kharagpur. Over there he passed the entire tests and got eligible. From that onwards his life changed completely and got the best turning point ever. He selected field of mathematics as his career and pursued Msc. in mathematics from same institute. As like “an icing on the cake” this visually challenged Pratish has recently been awarded with J C Bose Memorial gold medal for the being the best academic performer in his 2 years PG course in science. He was awarded by our respected president of India Mr. Pranab Mukherjee. Isn’t' that amazing? Of course it is... He says “for me my mind is my eye with my mind I can tackle any glitch of my life... ”.Pratish has the future goal to pursue PhD. in networking field and the field of cryptography. Thus at the end of the story the first question which arises in our mind is “How can a visually challenged guy that too an IIT-ian, cope up with his studies tackling his problem of vision?” But answer to this is very simple, if anyone tries to do anything; lack of sight is hardly an impediment. His inner determination to learn things, his passion towards study, ideal and support of his parent, friends, and on priority his faculties of St .Xavier’s school Kolkata and the staff of IIT KHARAGPUR....hats off to you all....this story inspired me because a guy who have lost his vision, if he can touch the sky just with the sheer grit and determination.... then why can’t we all who have all our body parts well functioning? The things we need are just 2D's.....“Dedication and Determination” and we can do wonders... best wishes and salute to Pratish...

Wednesday, September 26, 2012

Commands that Should Never Run on Linux

There are some commands which a user should not run on Linux, because these commands can harm and destroy many things which are very important for the system. These problems are faced mostly by the new users of Linux. They run any commands on the terminal as they don’t have the knowledge about the Linux, and these commands cause them a lot. And the main thing is that the terminal never shows the warning message before we wish to run any commands on Linux terminal. So the care must be taken by the users before running any commands on Linux terminal.
So, some of the commands are as follows:
·         rm –rf/          :- DELETES EVERYTHING
The above command deletes everything which can be possible. Like the files on hard drives and attached removable device to the system.

rm      :This is for removing the files.
-rf       :Run rm recursively forcibly deletes the file and folder inside the specified folder without doing the confirmation.
/     -It says to start with the root directory.

The other commands like rm –rf~ will delete the files and folders of Home and the command rm –rf* will delete the configuration files.

·         :(){:|: &};:       :- FORK
The above command will creates the replica of itself .The process goes on and the duplicate copies also starts to create the replica of itself. This will take all the CPU time and memory.

·         mkfs.ext4/dev/sda1          :- FORMATS A HARD DRIVE
The above command will format the hard drive

mkfs.ext4      :This create a new ext4 file system on the following device.
dev/sda1      :This specifies the first partition of the hard drive.

This command will format the c:drive of the windows i.e. this will replace the first partition of the hard drive with the new file system. Similarly mkfs.ext3/dev/sda2 will format the second partition of the hard drive.

·         dd if=/dev/random of=/dev/sda :-WRITES THE GARBAGE ON THE HARD

This command will write the garbage values on to the hard drive.

dd=  : This part of the command performs the low level copying from one      
location to another.
if=/dev/random    -Use /dev/random as the input.
of=/dev/sda           -This outputs to the first hard disk causing to replace the file
                                     system with the random garbage values.

This command moves the file to /dev/null which is the special location. The moving of file to null location is similarly to destroying the files. This will move the files to /dev/null location as well it deletes the original copies.

mv     – This moves the file or folders to another location.
~         -This represents the entire home folder.
/dev/null    -Move the home folder to the /dev/null location.

·         command>/dev/sda :-WRITES DIRECTLY ON THE HARD DRIVE
The above command will run the command part and the output of that command is send directly to the hard drive. This directly writes the data onto the hard drive thus damaging the file system.

command  -This runs any command.
             >    - Sends  the output of the command to following path.
             /dev/sda  -This writes the output of the command directly onto the hard disk.

·         wget –o -|sh  :-DOWNLOADS AND RUN                     THE SCRIPT
This command downloads the script file which is mentioned, from the web and sends to sh, which executes the contents of the script. This can be harmful if we are not sure about the script code and its source. So we should not download from any unauthorized source.

wget  -Downloads the file.  -Download the file from this specified location.
| - This is the pipe which sends the output of the wget command i.e. the                    downloaded file.
sh – The file is sent to the sh command and it executes the file.

The user must have the complete knowledge about the command he wishes to run on the terminal. So he can himself, judge out the output and causes of the command. Otherwise, he has to face lots of consequences.

Monday, September 24, 2012

Creating a new Disk partition and formatting it in Linux

Disk utility can also be used to create new partitions and prepare them for use. Once a partition has been created, it must be formatted with a file system before it can be used. The standard file system used in Red Hat Enterprise Linux is ext4,the Fourth Extended File system.
In order to use the file system, we need to associate it with a mount point, and empty directory on a file system that is already available. Then the contents of that file system can be browsed as if they are the contents of the mount point directory. This is called as mounting the file system on the mount point.
A file which only root can edit, /etc/fstab, list what partitions should have their file systems mounted on what mount points with which options, one partition per line, A typical line may look like this:
/dev/sda6 /data ext4  defaults 1 2
This indicates that the ext4 file system on the /dev/sda6 partition should be mounted on the directory /data automatically using default options at boot time, and it should be backed up and checked for errors normally  
Once this is set, root can run mount /data to mount the file system above and umount /data to un-mount it.
File etc/fstab

 High- level steps for creating persistent storage
1.      Log into GNOME as a regular user.
2.      Use Disk Utility to create a partition. Enter the root password when prompted by the Authenticaion is required t o create a partition dialog.
3.      Format the file system and assign it a label.
4.      Test the file system by mounting it with Disk Utility (It will be mounted on the directoy /media/your-label.)                                                                                       
5.      Open a shell prompt with Application ---> System Tools ---> Terminal.
6.      At the shell prompt, type su – to switch to a root shell.
7.      As root, type the shell command mkdir /data to make an empty directory, /data, for the file system.
8.      Use gedit to add a line to /etc/fstab which will mount the ext4 file system in your new partition on your mount point (/data in this example), using default options as in the example above. Save /etc/fstab.
9.      As root, run  umount  /media/your-label, then mount /data. verify that your partition is mounted on /data by highlighting the partition in Disk Utility.
10.  Reboot to confirm that the file system mounts automatically on the desired mount point.

Sunday, September 23, 2012

Unauthorized access in windows

We are much familiar with windows operating system, there are lot of vulnerability’s in Microsoft’s windows operating system. I am discussing here one from them might be you are all unaware of this. In our college defreeze software is installed to prevent from attacks by virus or unauthorized access. But this weakness of operating system does not protected by defreeze completely, because it restore data after operating system.
Windows service pack 2 allows normal user such as “student” in our college(which restricted for complete use) to create an new account as administrator, but we have to create account in some different way stated in following stapes:
  • Right Click on my computer icon and go to manage, look at left side panel there is option “Local Users and Groups”. As shown in fig1. mangement functions
  • Click on “Local Users and Groups” and will see all account which are available in our system.Right click on free panel we will see options new user click on it and create new account as shown in fig 2.
fig2.creating account

  • Now click on groups in panel and right click on “Administrator” we see different option select “Add to group” as shown in fig 3. Now new window comes.
fig3.selecting group to add account
  • Now click on Add button, it will display new window.     
fig4.adding account in admin group
  •  Now click on Advanced button it will open new window.
fig5.selecting user
  • Now click on Find now button it will display all available account and one from them is our created account “Ravikumar” select it and click on ok.
fig6.seleting account to add in admin

  • It will display a message just ignore it. Now click on ok and apply buttons.
  • Log off from current account (don’t restart defreeze will delete last created account) and loin through last new created account. It will ask for changing password, proceed.
  • Now you have complete administrator authority you can do anything. When system is restarted account is deleted by defreeze. 


DDD: Best Visual Debugger

Debugging is the most important activity in the software and program development. In order to remove or identify the logical errors in the program; debugging is done. Linux uses the utility of ‘gdb’ (GNU Debugger) to debug the programs. It has a strong instruction set but lacking in visual GUI debugging utility. 
DDD or Data Display Debugger is a visual debugger made available under GNU public license uses the gdb activities with GUI at foreground! Not only gdb but ddd has in-built command-line debuggers such as DBX, JDB, HP Wildebeest Debugger (WDB), XDB, the Perl debugger, the Bash debugger, the Python debugger, and the GNU Make debugger etc. So, by this visual debugger you can debug programs of C, C++, Java, Shell, Perl, Python etc.
Here I am giving a small tutorial to show how to use ddd to debug the C programs. The advanced tutorials will be given afterwards.
Let’s start… As I told ddd is available under GPL, so you can download the debugger using following command directly by debian version Linux.
sudo apt-get install ddd
or you may go to ‘Ubuntu Software Centre’ and search for ‘ddd’ as shown in the picture 1 below. You may get information about it and install from there.
[Note: If images are not visible, click on it to view large]
Picture 1: DDD entry in Ubuntu Software Centre
For example, you have written a C program code named ‘basic.c’. Compile it using gcc in the following fashion:
gcc –g –o basic basic.c
here, -o suggests the name of the output file that you will create after compilation of ‘basic.c’ and –g suggests that you are giving ability to debug this program. If the –g is missing your program can’t be debugged by gdb or ddd. After compilation you will get an executable file named ‘basic’ (without extension). Note: you may give any name to your executable file at the time of compilation after option –o.
Your program will be compiled successfully as shown in the picture 2 below.
Picture 2: Compilation of program for debugging
Now, open your ‘ddd’ by simply typing ‘ddd’ on the terminal.
Open your program ‘basic.’c by using ‘File’ menu -> open program option. Your program will be opened as shown in the picture 3 below.
Picture 3: The ddd windows
Your program will be visible in ‘Program Window’. Below of it, you may find ‘Assembly Code Window’, where the assembly equivalent code is shown. And below of this window, your gdb command line debugger is shown. You may instruct program directly by using gdb also! 
In order to set a breakpoint inside the program move your mouse on to respective line and press right click. You may get options as shown in the picture 4 below.
Picture 4 : Setting a breakpoint
The any number of breakpoints can be set in a single program. It is used for executing the program till that point. From that line onwards, you may execute program step-by-step. The breakpoints in the function can be set by typing the command ‘b main’ in the ‘gdb window’ also! Or ‘b 12’ can also be written. Here 12 is the line number in the program.
Now, go to ‘Program’ menu and click on the ‘Run’. Your program will get executed till the first breakpoint set. See the picture 5 below:
Picture 5: Watch variable values by F6
The green arrow shows the line which is in execution currently. Red dot shows the breakpoint. Now, from here onwards you may execute step-by-step just by pressing function key ‘F6’. The program execution will be processed step-by-step as you go on pressing ‘F6’. You may find arrow is traversing with the lines of execution. When you move the mouse on any variable used in the program, you may get the value of the variable on current execution. In the picture 5, you may see the values inside array ‘a’ is shown by the ‘ddd’ at mouse position. By this way you can check the contents of the variable at any point in the program.
You may check the content by typing the command in the ‘gdb window’ as shown in the picture 6 below. It has shown the contents of a[i] by typing ‘print a[i]’ in the gdb window.
Picture 6: Use gdb window.
The features of ‘ddd’ are not limited with this. It has a rich set of applications. Just find the options given in the ‘ddd’s menu. You will learn a lot!