Sunday, January 25, 2009

Enabling "password-less" login for ssh between 2 Linux machines

1. Generate a dsa or rsa public & private keys:
#ssh-keygent -t dsa
or
#ssh-keygen -t rsa

2. Copy the public key and complete the required formalities on the remote machine:
#ssh-copy-id -i ~/.ssh/id_dsa.pub user@IP-address

3. If all goes well you have successfully enabled password-less communication with the remote machine. Test it using "ssh"
#ssh IP-address

Labels: , , , ,

Saturday, January 24, 2009

How to connect to a Windows from Ubuntu !!!

1. Ubuntu comes bundled with "rdesktop". In case it's not install use:
$sudo install rdesktop

2. Make sure before connecting to the Windows machine the user with which you want to login has a password set against it.

3. You are all set to connect to the windows machine using "rdesktop" as show below:
#rdesktop -u administrator -g 750x500 -a 16 192.168.1.3

In case you don't want the password to be used, refer the following:
http://support.microsoft.com/default.aspx?scid=303846

Labels: , , , , , ,

Tuesday, January 20, 2009

Compressing PICS in Linux using command line !!!

Following example shows how I brought a 32 MB album to 7.6 MB

root@station3:/tmp/images/friends# ls -lh
total 32M
-rwx------ 1 root root 1.4M 2009-01-18 00:38 DSC00949.JPG
-rwx------ 1 root root 1.5M 2009-01-18 00:38 DSC00950.JPG
-rwx------ 1 root root 1.4M 2009-01-18 00:38 DSC00951.JPG
-rwx------ 1 root root 1.4M 2009-01-18 00:38 DSC00952.JPG
-rwx------ 1 root root 1.4M 2009-01-18 00:38 DSC00953.JPG
-rwx------ 1 root root 1.4M 2009-01-18 00:38 DSC00954.JPG
-rwx------ 1 root root 1.3M 2009-01-18 00:38 DSC00955.JPG
-rwx------ 1 root root 1.4M 2009-01-18 00:38 DSC00956.JPG
-rwx------ 1 root root 1.3M 2009-01-18 00:38 DSC00957.JPG
-rwx------ 1 root root 1.4M 2009-01-18 00:38 DSC00958.JPG
-rwx------ 1 root root 1.4M 2009-01-18 00:38 DSC00959.JPG
-rwx------ 1 root root 1.5M 2009-01-18 00:38 DSC00960.JPG
-rwx------ 1 root root 1.4M 2009-01-18 00:38 DSC00961.JPG
-rwx------ 1 root root 1.2M 2009-01-18 00:38 DSC00962.JPG
-rwx------ 1 root root 1.2M 2009-01-18 00:38 DSC00963.JPG
-rwx------ 1 root root 1.2M 2009-01-18 00:38 DSC00964.JPG
-rwx------ 1 root root 1.4M 2009-01-18 00:38 DSC00965.JPG
-rwx------ 1 root root 1.4M 2009-01-18 00:38 DSC00966.JPG
-rwx------ 1 root root 1.3M 2009-01-18 00:38 DSC00967.JPG
-rwx------ 1 root root 1.3M 2009-01-18 00:38 DSC00968.JPG
-rwx------ 1 root root 1.3M 2009-01-18 00:38 DSC00969.JPG
-rwx------ 1 root root 1.3M 2009-01-18 00:38 DSC00970.JPG
-rwx------ 1 root root 1.3M 2009-01-18 00:38 DSC00971.JPG
-rw-r--r-- 1 root root 1.1M 2009-01-18 00:38 DSCN3857.JPG

root@station3:/tmp/images/
friends# mogrify -verbose *JPG -quality 60 *JPG

root@station3:/tmp/images/
friends# ls -lh
total 7.8M
-rwx------ 1 root root 435K 2009-01-18 00:40 DSC00949.JPG
-rwx------ 1 root root 363K 2009-01-18 00:40 DSC00950.JPG
-rwx------ 1 root root 269K 2009-01-18 00:40 DSC00951.JPG
-rwx------ 1 root root 253K 2009-01-18 00:40 DSC00952.JPG
-rwx------ 1 root root 331K 2009-01-18 00:40 DSC00953.JPG
-rwx------ 1 root root 334K 2009-01-18 00:40 DSC00954.JPG
-rwx------ 1 root root 285K 2009-01-18 00:40 DSC00955.JPG
-rwx------ 1 root root 349K 2009-01-18 00:40 DSC00956.JPG
-rwx------ 1 root root 314K 2009-01-18 00:40 DSC00957.JPG
-rwx------ 1 root root 380K 2009-01-18 00:40 DSC00958.JPG
-rwx------ 1 root root 312K 2009-01-18 00:40 DSC00959.JPG
-rwx------ 1 root root 305K 2009-01-18 00:40 DSC00960.JPG
-rwx------ 1 root root 258K 2009-01-18 00:40 DSC00961.JPG
-rwx------ 1 root root 204K 2009-01-18 00:40 DSC00962.JPG
-rwx------ 1 root root 274K 2009-01-18 00:40 DSC00963.JPG
-rwx------ 1 root root 270K 2009-01-18 00:40 DSC00964.JPG
-rwx------ 1 root root 286K 2009-01-18 00:40 DSC00965.JPG
-rwx------ 1 root root 259K 2009-01-18 00:40 DSC00966.JPG
-rwx------ 1 root root 305K 2009-01-18 00:40 DSC00967.JPG
-rwx------ 1 root root 313K 2009-01-18 00:40 DSC00968.JPG
-rwx------ 1 root root 307K 2009-01-18 00:40 DSC00969.JPG
-rwx------ 1 root root 312K 2009-01-18 00:40 DSC00970.JPG
-rwx------ 1 root root 252K 2009-01-18 00:40 DSC00971.JPG
-rw-r--r-- 1 root root 874K 2009-01-18 00:40 DSCN3857.JPG
root@station3:/tmp/images/
friends#

Alternatively we can also use:
root@station3:/tmp/images/friends#
mogrify -verbose -resize 800x600 *JPG

Now it's time to further compress the album.
root@station3:/tmp/images/
friends# cd .. ; tar -czvf friends.tar.gz friends
friends/
friends/DSC00954.JPG
friends/DSC00961.JPG
friends/DSC00953.JPG
friends/DSC00956.JPG
friends/DSC00949.JPG
friends/DSC00958.JPG
friends/DSC00965.JPG
friends/DSC00962.JPG
friends/DSC00969.JPG
friends/DSC00963.JPG
friends/DSC00967.JPG
friends/DSC00951.JPG
friends/DSC00952.JPG
friends/DSC00970.JPG
friends/DSC00964.JPG
friends/DSC00968.JPG
friends/DSC00971.JPG
friends/DSC00950.JPG
friends/DSC00955.JPG
friends/DSC00966.JPG
friends/DSC00960.JPG
friends/DSC00957.JPG
friends/DSCN3857.JPG
friends/DSC00959.JPG

root@station3:/tmp/images# ls -lh
total
7.6M
drwxr-xr-x 2 root root 4.0K 2009-01-18 00:24 friends
-rw-r--r-- 1 root root
7.6M 2009-01-18 00:45 friends.tar.gz
root@station3:/tmp/images#

Alternatively you can also convert all the pics into pdf as shown below:
root@station3:/tmp/images#
convert -verbose *JPG all_in_one.pdf



Monday, October 20, 2008

BASH IDE plugin for GVIM

http://www.linux.com/feature/114359


Download location of plugin:
http://www.vim.org/scripts/script.php?script_id=365


Or just execute the script given below to download and install the IDE.
(Script "unit" tested on Debian & OpenSUSE but should work out of the box on any other NIX flavor .)


Couldn't test this script on FreeBSD.
(as couldn't find "gvim" port under ftp://ftp.freebsd.org/pub/FreeBSD/ports)


#!/bin/bash
#===============================================================================
#
# FILE: gvim_bash_ide.sh
#
# USAGE: ./gvim_bash_ide.sh OR sh gvim_bash_ide.sh
#
# DESCRIPTION: The scripts downloads the bash ide plugin for gvim, extracts it & copies it under ~/.vim
#
# OPTIONS: ---
# REQUIREMENTS: gvim
# BUGS: ---
# NOTES: The script assumes gvim installed. Revision 1 of this file was tested on Debian 4.0 R2 & OpenSUSE 10.3.
#
# AUTHOR: Parag Kalra, paragkalra@gmail.com
# COMPANY: As of now (19-Oct-08) Persistent Systems LTD
# VERSION: 1.0
# CREATED: Sunday 19 October 2008 09:40:49 IST IST
# REVISION: 1
#===============================================================================

SRCID=9304

if [ -f /etc/debian_version ]
then
echo -e "\nSeems as if you are using Debian. Please make sure that gvim is installed. It comes packed with DVD ... \n"
elif [ -f /etc/SuSE-release ]
then
echo -e "\nSeems as if you are OpenSUSE or may be SLES. Please make sure that gvim is installed. It comes packed with DVD ...\n"
elif [ -f /etc/redhat-release ]
then
echo -e "\nSeems as if you are using Redhat or Fedora. Please make sure that gvim is installed. \n"
else
echo -e "\nPlease make sure that gvim is installed before adding bash ide plugin ... \n"
fi

if [ -d ~/.vim ]
then
echo -e "Directory ~/.vim already exists ... \n"
else
echo -e "Creating vim directory under user's home directory ... \n"
mkdir ~/.vim
echo -e "Navigating into ~/.vim \n"
cd ~/.vim
fi

echo -e "Downloading bash ide plugin for gvim from www.vim.org ... \n"
wget --verbose -P~/.vim http://www.vim.org/scripts/download_script.php?src_id=$SRCID -O bash-support.zip

#As of now this script downloads latest bash ide plugin. To download the latest plugin:
# 1. get the latest "src_id" from http://www.vim.org/scripts/script.php?script_id=365
# 2. and change the the "SRCID"

echo -e "Navigating into ~/.vim \n"
cd ~/.vim

echo -e "Unzipping bash ide plugin for gvim ... \n"
unzip bash-support.zip

echo -e "\nDeleting unused files ... \n"
rm -rf bash-support.zip

if [ -f ~/.vim/plugin/bash-support.vim ]
then
echo -e "Seems as if all went good. Open gvim and check the bash ide plugin ... \n"
else
echo -e "Something got screwed. Figure it out yourself ... \n"
fi

Just go through it and let me know if you happen to come across any bug in it. eMail me at paragkalra@gmail.com


© COSEC
Wanna Learn and Know more about Linux, log on to
http://discoverlinux.blogspot.com/

Labels: , , , , , , , ,

Sunday, June 08, 2008

When the File-System Crashed.

Although it's a old story but still it's give a lump in my throat to tell that you that Hans Reiser, the programmer that created the ReiserFS filesystem, was convicted on 28th April, 2008 of first-degree murder for killing his estranged wife, Nina Reiser.

The verdict followed a nearly six-month trial and nearly three days of deliberation. Reiser faces a mandatory sentence of 25 years to life in prison.





Reiser was a child prodigy who dropped out of junior high school and enrolled at the University of California Berkeley at age 15. After college, he made his mark in the business world, starting a technology company and developing a new computer file system some consider revolutionary.

So how did a self-described "computer nerd" capture the heart of a beautiful obstetrician born in Russia? Reiser went to Russia looking for cheap labor for his computer business, and a bride. A dating service arranged a meeting at a café in St. Petersburg, but Reiser didn't fall for his date -- he liked the woman who came along to translate.

"She has the most beautiful voice," Reiser said. "When I first heard it I thought, 'This is someone special.'"

Just over a year later, Reiser married his Russian bride, who was by then five months pregnant. A bizarre wedding video shows a nontraditional wedding -- Reiser's best friend Sean Sturgeon, dressed in drag, was the maid of honor.

"I think that what interested [Nina] in Hans was that he was different from everyone else," said her friend Ellen Doren.

"Nina is entirely unique," Reiser said. "Try to imagine a well-educated Marilyn Monroe, who's a doctor."




The birth of their son Rory, now 8, and daughter Niroline, now 6, were happy times for the couple. "Nina was one of the best parents I've seen in my life," Doren said.

Reiser, who lost custody of his children in the divorce proceedings before his wife's disappearance, said, "I miss them so much. It's been so long."

But fights about how those children were being raised were at the center of a marriage that began to crumble. Doren said she was witness to the emotional disputes.

"They just could not agree on how to raise the kids," she said. "And there were very many, many fights and conflicts."

Open source developers say Reiser, now 44, is a brilliant software programmer who dropped out of school at 14 and fast tracked to UC Berkeley where he focused on file system development for Linux. His genius notwithstanding, Reiser was said to have interpersonal problems and exhibited anti-social behavior that aliented some members of the Linux kernel project and the judge in the murder case against him.




Ted Ts’o, a top linux kernel developer and fellow at the Linux Foundation, heads up the ext3 file system and ext4 open source project that competes with Reiser’s file system. Ts’o contends that Reiser is a talented programmer whose work was overshadowed by his temperament but whose file system technology may have a better shot under new management.

“Hans was not the easiest person to work with and and it’s ironic that that having some of these folks [who now work on the Reiser4 project] interact with the Linux comunity allows Reiser4 to make more of a focus toward mainline inclusio simply because hans was his won worst enemy and questionable social skills,” Ts’o said. “Hans was technically brilliant but socially not at quite the same level.”



© COSEC
Wanna Learn and Know more about Linux, log on to
http://discoverlinux.blogspot.com/

Sunday, June 01, 2008

Concept of Volume Label in Linux

Initially when I bought my first PC 4 years back I started off with Windows XP. Assigning volume label or renaming a partition in windows was indeed very easy. It was just a "right click" stuff. After a year or so I then switched over to Linux and have never looked back since then.

In Linux I never felt the need to rename a partition because Linux treats partitions by device files or mount points. However if you are still interested in assigning a volume label to a partition from Linux, here is what you should:

# umount /dev/sdmn
# tune2fs -L /dev/sdmn
# mount -a

e.g.
# umount /dev/sdb3
# tunefs -L DEBIAN /dev/sdb3
# mount -a

The best of this is that same volume-label which is assigned to the partition under concern is also visible in Windows as well and rightly so.

The million dollar question is how can you use volume-label in Linux. I will explain it using my own example. I have many disk-drives (more than 5 hard-disks in my home pc) each disk-drive having some or the other Linux installed on it. Every now & then I take my disk-drives out of the box for data-exchange or for maintenance. In that process sometimes a disk drive is attached to a new slot or interchanged with some other slot as a result of which position of disk-drives (hda, hdb, sda, sdb, sdc) gets changed and eventually it leads to mismatch between disk-drive position and it's entry in "/etc/fstab". This makes the system non-bootable or partition having it's entry in "/etc/fstab" doesn't gets mounted.

To avoid this it's always advisable to assign a volume label to the partitions and refer the partitions in "/etc/fstab" by it's volume label. A typical example of an entry referred by it's volume label in "/etc/fstab" is shown below:

# cat /etc/fstab | grep -i label
LABEL=/ / ext3 defaults 1 1
LABEL=DEBIAN /debian ext3 defaults 0 0

The 1st & 2nd entry in above example could also have been:
/dev/sda1 / ext3 defaults 1 1
/dev/sdb3 /debian ext3 defaults 0 0

But if the disk-drive /dev/sda or /dev/sdb are removed for some reason or if their positions are interchanged then they won't get mounted.

However if the partitions are referred by volume labels then this situation of crisis will never arise. Thats amazing. Kindly share your views and don't hesitate to shoot in your queries if any.

© COSEC
Wanna Learn and Know more about Linux, log on to
http://discoverlinux.blogspot.com/

Labels: , , , ,

Wednesday, May 14, 2008

Accessing ext2/ext3 formated Linux partition from Windows in read/write mode.

I didn't know that it was so easy to access ext2/ext3 formated Linux partition from Windows and that too in read/write mode. There is a superb lightweight opensource software "fs-driver" that can be installed on Windows (NT4.0/2000/XP/2003/Vista) which enables this feature. Just download the software from following URL, install the software and enjoy the stable & reliable ext2/ext3 Linux partitions:
http://www.fs-driver.org/

© COSEC
Wanna Learn and Know more about Linux, log on to
http://discoverlinux.blogspot.com/

Sunday, April 27, 2008

Opening CHM Files in Linux

The most dismaying thing encountered by a Linux user is the inability to view CHM (Compressed HTML) files in Linux. However thanks to Firefox for making this awesome addon that enables you to view CHM files through Firefox itself.

Just go here to download it and also read the steps to use it:
https://addons.mozilla.org/en-US/firefox/addon/3235



© COSEC
Wanna Learn and Know more about Linux, log on to
http://discoverlinux.blogspot.com/

Sunday, April 13, 2008

Debian and it's Doors & Windows!


Flowchart of the Life Cycle of a Debian Package.



Diagram of the Organizational Structure of the Debian Project.


Release Cycle of Debian Linux till 12th April, 2008



© COSEC
Wanna Learn and Know more about Linux, log on to
http://discoverlinux.blogspot.com/

Friday, December 28, 2007

Second Update of Debian GNU/Linux 4.0 released

Source: http://www.debian.org/News/2007/20071227

© COSEC
Wanna Learn and Know more about Linux, log on to
http://discoverlinux.blogspot.com/