Wednesday, February 3, 2010

how to ssh without password

Let say you want to access to a machine with IP 192.168.1.10, and make sure you have
command ssh, ssh-keygen, ssh-copy-id.
First, generate the ‘key’, the key will be used to open the remote machine’s door.
ssh-keygen

You will see something like that
Enter file in which to save the key (/home/myname/.ssh/id_rsa):

Whatever it appears just press enter until it ends, press enter for passphase as well.
Okay, the ‘key’ will be generated, something looks like ~/.ssh/id_rsa.pub
Copy over the ‘key’ to remote machine, and enter your password
ssh-copy-id -i ~/.ssh/id_rsa.pub macspc@192.168.1.10

Done. Now you can ssh 192.168.1.10 with username macspc without password.
ssh macspc@192.168.1.10

What I Did

~? ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/brijith/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/brijith/.ssh/id_rsa.
Your public key has been saved in /home/brijith/.ssh/id_rsa.pub.
The key fingerprint is:
4b:71:39:69:36:13:0a:69:65:21:de:5f:24:b4:1c:b6 brijith@Newmegadisk
~? ssh-copy-id -i ~/.ssh/id_rsa.pub macpc@192.168.1.10
29
Password:
Now try logging into the machine, with "ssh 'macspc@192.168.1.10'", and check in:
.ssh/authorized_keys
to make sure we haven't added extra keys that you weren't expecting.


Now you can login through ssh with out a password

ssh macspc@192.168.1.10


It wont ask password any more.

If you want to launch application of the remote system in your PC using ssh use -X option of it

eg:

ssh -X macspc@192.168.1.10

and then give the application name you want to launch in resulting terminal
eg:
gedit&

This will launch gedit of remote system in your system

gedit

Password Less Dump in MYSQL

MySQL is perhaps one of the most popular database systems currently available. It has a lot of great features, it's open source, and a lot of Web-based applications use it for their back-end storage.
One important part of running a database is maintenance, and that includes backups. However, due to the fact that the database is password-protected, one can't automatically back up the database without interactively supplying the password. And, depending on what you need to back up, you may even have to use the MySQL "root" user to do a full backup.
You can avoid those hassles by creating a configuration file for the user to do the backups (i.e., /root/.my.cnf). This user does not need to be the system root user; it can be any normal system user who has access to the database as the database's root user. The ~/.my.cnf file would look like:
[mysqldump]
user = root
password = secret

With this, you can automate a dump of the database via a cronjob, without being asked for a password. You will still need to supply a password using the mysqladmin or mysql tools, but not with mysqldump. Now, to automate the backup, run the following script out of cron:

#!/bin/sh
mysqldump -u root --all-databases >/var/lib/sqldump/mysql.dump


Some people may consider this horribly insecure, but it's no more insecure than doing it manually, especially if this is being done by the root (or even mysql) user. If the file is adequately protected (mode 0600), your database is just as safe. Remember that an attacker would have to obtain root privileges in order to read the file. If that attacker had root privileges, they could simply make a copy of your database, retrieve it, and open it on any MySQL installation at their home and be able to read the contents of your database at their leisure, without once requiring the database password.
Because there is just as much (or just as little, if you prefer) security in supplying the database root password in a configuration file, there is really no reason not to do it. The benefit is that providing password-less access can make things like automated database maintenance far easier.

Setting Up offline multiple language dictionary in Ubuntu

All of you might have see a Dictionary application Under Office Menu in every Ubuntu distro. By default it is configured to work with online dictionary server. So the people we have an Internet connection will miss this application. No,not really,It is possible to configure so that it can work well as if it is online. following are the steps

Start Up synaptic and find the following packages and mark for installation

dict
dictd


these are the server and client for a dictionary services

apart from the above if you continue searching in sequence (to the above mentioned packages) you will find a whole lot of dictionaries -the ones i have installed are
dict-bouvier
dict-devil
dict-elements
dict-foldoc
dict-freedict-eng-deu (english to german)
dict-freedict-eng-hin (english to hindi)
dict-freedict-hin-eng (hindi to english)
dict-gcide
dictionaries-common
dict-jargon
dict-moby-thesaurus
dict-vera



After installing this (and other dictionaries of your choice) there is a small tweak we need to do to make the dictionary work offline

Go to Applications --> Office--> Dictionary and run the programme Dictionary

In the Open Application go to Edit --> preferences
In Source select ADD and
in description add any name you want to use for your customized dictionary services (replace source with a identifiable name)
Let transport be as it is (Dictionary Server)
change Hostname to 127.0.01 (replace dict.org)
Port - Leave as it is. enter add then in the Select a Dictionary Source for looking up words Select the Dictionary source your just added
Enter Close
Type any word to test if the dictonary works (you can / should test with your internet off)
If you get a meaning or any output means its working. Congratulations.