Friday, December 28, 2007

Every wondered how an unpriveledged user could read /etc/group,/etc/shadow files ??

Well I am sure all u Linux Newbies have a question in mind if we are not privileged enough to read the restricted /etc/group, /etc/shadow etc .. file and a situation comes wherein we need to read or edit them then how do we go about it ? Well i have an answer to this in Linux we have a command called vipw,vigr which are there to help you I wont go much in detail's here and would recommend to read the man page of the same

Friday, March 16, 2007

Setting Up LVM(Logical Volume Manager) Using The Command Line Tools.

This is very useful to automate the setup, e.g. when you have lots of LV(Logical Volumes) to be created. We simply follow the three basic steps:

Step 1 (PVs): pvcreate /dev/device [/dev/device] ...
The command initializes (a) physical device(s) as (a) physical volume(s) (PV). Partitions must have the partition ID 8E (use fdisk, cfdisk or yast for partitioning), (whole) disks must have no partition table(Though you can create Physical Extents even if you have some raw space on your harddrive). To see all physical devices that are available, use the command lvmdiskscan. The command pvscan shows all existing PVs. If a disk (the whole disk, e.g. /dev/sdc) cannot be used and pvcreate complain about it having a partition table, after making sure you really want to use this disk for LVM and do not have anything else on it you can erase the partition table with dd if=/dev/zero if=/dev/device−name bs=1k count=1(followed by blockdev −−rereadpt to tell the kernel to re−read the p.table).

Step 2 (VGs): vgcreate vg−name /dev/device [/dev/device] ...
The vgcreate command creates a volume group with all the physical volumes specified. The default extent size is 4 MB. The limit for the number of physical extents/logical extents on a PV/LV is 65534 due to kernel limits. Therefore, the default size of 4MB limits the max. size of any PV or LV to 4M*65534~255GB.Should you have larger PVs or require bigger LVs you can increase the extent size. A PE is also the smallest unit by which you can increase, decrease or address (e.g. to move PEs to other PVs) storage in LVM.

Step 3 (LVs): lvcreate −L size[K|M|G|T] −n lv−name vg−name
The lvcreate command creates a logical volume on the volume group vg−name. If no name is given for the LV the default name lvol# is used, where # is the internal number of the LV. The LV can be created as striped (RAID0) over several or all available PVs using the −i # parameter, where # specifies the number of stripes. Normally LVs use up any space available on the PVs on a next−free basis, i.e. if you do the creation of LVs one by one you essentially get concatenation, until you start shrinking, growing, deleting and so on,when space gets freed and reallocated anywhere on the PVs.This is all. From now on you can use the LVs by referring to them via /dev/vg−name/lv−name. Use them like you would use any partition.

Automatic server setup from stored LVM setup.
The LVM of the server can be reset using lvmchange. This is a last resort if something goes wrong. It does not change the LVM setup stored on the physical devices, only the data in the running system is reset.To restore an LVM setup from the one stored on disk, run first vgscan to find all VGs and then vgchange −a y to activate them. This is what happens at each boot time, see init file /etc/init.d/boot (look for vcgscan). You can completely delete the local LVM setup information with rm −rf /etc/lvm*, including all device files for accessing the LVs (/dev/vg−name/lv−name), and it will automatically be recreated next time you boot or issue the vgscan command manually. This means that you do not have to do anything after a reboot to be able to use your LVs again, the runtime LVM setup happens automatically during a system boot, if any LVM setup is detected on any of the attached physical devices.





Saturday, February 3, 2007

Creating Multiple Accounts in one go

Have you ever come across a situation wherin you have to create multiple accounts with similar names in a certain numeric sequence.Well even if u have did you ever think of automating the entire process so that you run one script and all that you have to do is keep entering their passwords. So here we go simply follow the procedure below.

Step 1.) Write this code in one file and save it.
for i in `seq 1 50`;
do
useradd user$i
passwd user$i
done

Step2.) Using chmod 777 make it an executable.

Step3.) Run the script using ./scriptname

Once you have executed the script all you have to do is keep entering the passwords for the accounts.

Saturday, January 27, 2007

Phishing Was it Real ?

Well it was 6pm on thursday and I heardone of my friends say it loud "I have bein phished and wiped out of almost fifty thousand rupees" he realised this when he had logged in to his UTI bank account. I was shocked for a second and then thought that it must have been some knd of a joke he's playing on me (cause just two days ago we were discussing about the amount of e-crime thats happening around) well i was completely incorrect cause he removed the FIR(first information register ) copy from his bank wich the bank had given him saying that his money had bein transferred to some account which has being locked for the time being and that after investigation if it is the customers mistake for not taking the precautions then it will not be the banks responsibility.Well as usual I checked the site tha he had logged in by mistake and it looked like a UTI Bank's website which asked him for his username and password., Ill be posting the link soon.Anyways all i wanted to tell myself afer all this was that if educated people can make mistakes who are working in the IT sector then things can be worse with others.

Monday, January 22, 2007

What is Linux Anyways?


For all those who are new to Linux. Linux is an Operating system with a difference unlike Windoze where user friendliness is the key here the Shell prompt is where the true power is .From x86 to PowerPC to Sparc , from 486 to the Blue Gene it Linux Everywhere.Linux has come along way from a community development OS to Fully Supportive OS from Novell to RedHat.