Categories
Operating System

My first use of awk command

Hi,

today I has to detect the machines IP. So I thought to make use of “awk” for it and got build this command

ifconfig eth0 | awk ‘/inet addr:/ {print $2}’ | cut -d\: -f2

first get the ifconfig output to awk, find “inet addr:” in it (for ip version 6 use “inet6 addr” ) than cut it in piece and pick the second one

as simple as that

Categories
Operating System Programming

Patching Source Code in Linux

Recently I download one source code for linux box, But unfortuntely that code is too old (2002) so we need to patch the source code as its available for my Linux distro.

Command is simple for it though we need a PATCH installer package first.

Command is

patch -p1 < [Patch_file_name]

this will patch your source code…

Ah one thing, your patch file must be in root of your source code 🙂

So enjoy your patched codes

Sumit Gupta

Categories
Operating System Server Configuration

Atlast A Successful install of Linux OS on my pc

I have been trying to install linux on my personnel pc from last 5-6 years ( actually I try it only 10 -12 times ) but always I end up crashing my Windows machine and hence, never install it on my pc. But during last 5-6 months I am working on a project in my office, which is entirely on Linux platform. Hence, I learn some if and buts of linux there…

Now that I have some confidence on how to do that, I try to install linux on my Personnel PC and a magic happens. I have a Working Linux on my box, with a single crash.

I dual boot it with Windows XP for now… and never remove it from dual booting, afterall I am MS techonlogy developer as well.

If any one need some help on Linux, now you can ask me, I am confident to help.. btw for help you can visit http://www.linuxquestions.org as well its a good site.

Now, let me work on my linux box…

Sumit Gupta

Categories
Operating System Server Configuration

Linux Password reveal

Hi,

I just discover how a Linux password is formed. This information is useful for those who have to write a piece of code for their software to either match user authentication or make new user from their script. Though Linux Provide PAM for the purpose, but for me configuring PAM for you application that can generate its password itself is not useful. But its recommended as its General application and if in future Linux authentication method or password saving change you can easily adopt to it.

Anyways, here is where we store User information in linux

/etc/passwd

and here we store its password

/etc/shadow

now shadow file has column seperated by [ : ] colons
like
sumit:$1$YgUxVnSK$/Y/QjCfBDyoZriQ7oQnxs.:13316:0:99999:7:::
in this it tells there is a user call sumit with password as $1$YgUxVnSK$/Y/QjCfBDyoZriQ7oQnxs.

This password is divided in Three parts seperated by $ (dollar) sign.
$1 is indication of fact taht its an MD5 crypted password
$YgUxVnSK is the salt use to crypt the password
$/Y/QjCfBDyoZriQ7oQnxs. is the password
But these values are read without $ sign :o)

So if you need to make a linux password simple take a Salt for your Password encryption and crypt your password with it and than append $1 with both values and write it in Shadow file.. simple

in PHP its quite simple to do …just call crypt function with out any salt

like

$password= crypt(“mypassword”);

And in PERL you need to ensure a random salt as crypt function of perl produce different result on windows and on Linux :o(

in windows machine crypt function call will be
$password= crypt(“mypassword”,””);
produce some thing like

/Y/QjCfBDyoZriQ7oQnxs.

where as in linux it will be full linux password style

Hope I am clear in telling linux password, as programmer you don’t need to know more on this…

Sumit Gupta

Categories
Operating System Server Configuration

Linux Problems

Hi,

I have been trying sendmail and Exim for whole day. Looking what exactly they are and how to use them. But still stuck on what they are. I found Sendmail and Exim both are MTA (Mail Transfer agent), but still my Cpanel installation shows that I have sendmail and exim install on same server, How can this be? If I have sendmail listening on Port 25 than where exim is listening for email?

Anyone any idea please post comment so that I can work on my project.

thanks everyone

Sumit Gupta

Categories
Operating System

Difference between Liunx and Windows

We all have gone through this discussion somewhere in our life and we keep doing this. I respect both software in sense they have there own commerical market. I did not rate any one above other as they target different audience to me. Its just that they try to take others market in different fields.

Some one told me Linux is free, Okay its free so…I have to download 700MB CD to make it run and Need a Internet connection to download all its free softwares and have to be connected to internet all time to make it run whenever I got any error.

But on windows once paid I never have to call there customer support nor I did need to Search internet for solution.. it just run every for me… For me its Cost is Covered..:D

Okay thats not my topic of the day. Let me give my points

Linux

* Has Better Security than Windows because it has Better User Rights Management (User Management is similar in both) its just that Linux has use better Rights policies from scratch.

* Has Speed and Control of even the smallest application like even you can remove Copy file command from your linux box.

Windows
* Has Organize Developement Framework : Please don’t argue this with me, if its not than my PHP has two different version running parallely to each other , Why I still see Kernel 2.4 source for download , Why we have issue with upgrades on linux more than Windows. the truth is that Windows use Oops in better way than Linux, Most of Open source software are in process of having two version running simultenously, but Windows run one software at a time (technically) not in terms of version . I dont mind having Red Hat linux and Debian Linux and Fedore.

* Has Better User Interface: yes there are themes in linux much better than Windows (not Includes Vista here) But I really feel these theme loose consistency and User has to see and wait for mouse over popup to come before he click on new theme button.
Now with Vista Windows lose that point I guess though I never review it. (Anyone please send me its CD .:oD )

* (-) Bulking Graphics Engine and Too many Bulk code is going with windows, I believe Microsoft never clear their Code for Windows if they does Its install size must reduce by 200 -300 MB they have lot of Useless bulking code and software going with windows…

Hope I didn’t break some ones heart

Sumit Gupta