ssh-keygen to SSH without using passwords

Writing by on Friday, 18 of May , 2012 at 5:25 pm

The below example will demonstrate how shivdev@sk-optiplex can SSH to shivdev@sk-redhat without a password. The idea is to create SSH (public/private) keys on sk-optiplex and then copy the public key /home/shivdev/.ssh/id_dsa.pub from sk-optiplex over to sk-redhat as ./ssh/authorized_keys2.

I’m using SSH 2 with DSA encryption, because I just couldn’t get SSH with RSA encryption to work.

shivdev@sk-optiplex:~$ ssh-keygen -t dsa
Generating public/private dsa key pair.
Enter file in which to save the key (/home/shivdev/.ssh/id_dsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/shivdev/.ssh/id_dsa.
Your public key has been saved in /home/shivdev/.ssh/id_dsa.pub.
The key fingerprint is:
73:4a:b1:d3:d6:3c:fc:ed:c7:c6:61:18:0f:fb:06:6b shivdev@sk-optiplex
The key’s randomart image is:
+–[ DSA 1024]—-+
| |
| |
| . |
| + + o |
| S + = * |
| . * * = |
| . *oo|
| E +=|
| . ..o|
+—————–+
shivdev@sk-optiplex:~$ scp /home/shivdev/.ssh/id_dsa.pub shivdev@sk-redhat:.ssh/authorized_keys2
The authenticity of host ‘sk-redhat (sk-redhat)’ can’t be established.
RSA key fingerprint is b4:3a:15:5d:cb:5d:7e:05:39:35:0d:9c:1f:d4:84:08.
Are you sure you want to continue connecting (yes/no)? yes
Failed to add the host to the list of known hosts (/home/shivdev/.ssh/known_hosts).
shivdev@sk-redhat’s password:
id_dsa.pub 100% 610 0.6KB/s 00:00
shivdev@sk-optiplex:~$ ssh shivdev@sk-redhat
The authenticity of host ‘sk-redhat (sk-redhat)’ can’t be established.
RSA key fingerprint is b4:3a:15:5d:cb:5d:7e:05:39:35:0d:9c:1f:d4:84:08.
Are you sure you want to continue connecting (yes/no)? yes
Failed to add the host to the list of known hosts (/home/shivdev/.ssh/known_hosts).
Last login: Thu May 17 14:48:01 2012 from 10.4.21.184
[shivdev@sk-redhat ~]$

As you can see after copying over the public key from shivdev@sk-optiplex:.ssh/id_dsa.pub over to shivdev@sk-redhat:.ssh/authorized_keys2, shivdev@sk-optiplex is able to SSH into shivdev@sk-redhat without a password.

If you do get this error “Agent admitted failure to sign using the key.”, then you might need to run ssh-add or logout of the terminal and try to login again.

shivdev@sk-optiplex:~$ ssh shivdev@sk-redhat
Agent admitted failure to sign using the key.
shivdev@sk_redhat’s password:

shivdev@sk-optiplex:~$ ssh-add

shivdev@sk-optiplex:~$ ssh shivdev@sk-redhat
Last login: Thu May 17 14:51:01 2012 from 10.4.21.184
[shivdev@sk-redhat ~]$

Leave a comment

Category: Linux,Tips and Tricks

Installing RPMs from your CDROM by adding it to yum.repos

Writing by on Friday, 10 of February , 2012 at 12:59 am

RHEL can be such a pain! I installed RHEL 6.1 and there was no gcc on there!?! Now for whatever reason I needed it and it wasn’t able to get yum install gcc to work. I’m not surprised at all – RHEL/CentOS are well known for being tortuous!

So now I needed to install the gcc* rpm from the CDROM and again I run into dependency hell. No big deal – it’s a well known RHEL problem.

Fortunately, I found Adding cdrom to yum as repo which partially rescued me. Next, I ran into Public key for kernel-headers-2.6.32-131.0.15.el6.x86_64.rpm is not installed and followed this link to get me going.

Step 1: Mount your CDROM to /mnt/cdrom
$ mount /dev/cdrom /mnt/cdrom (For Example)

Step 2: Add the CDROM to your yum.repos (Tell yum to look at the CDROM as well while installing packages)
$ vi /etc/yum.repos.d/file.repo

Step 3: Paste the following
[local]
name=Local CD Repo
baseurl=file:///mnt/cdrom

Step 4: Tell yum to ignore any gpg key checking
$ vi /etc/yum.conf
Change gpgcheck=1 to gpgcheck=0

Step 5: Run the yum install and if found on the CDROM it’ll install it for you
$ yum install gcc (in my case)

Leave a comment

Category: Linux,Tips and Tricks

How to legally use the Verizon iPhone 4S overseas without roaming or jail-breaking

Writing by on Friday, 3 of February , 2012 at 6:16 pm

The iPhone 4s is a World Phone (supports GSM/CDMA) and upto 3G for data. It has a Micro SIM Card slot and can be used overseas. To unlock the phone, the carrier (Verizon etc.) will request/authorize Apple to unlock the iPhone and permit it’s use overseas.

Here are instructions on how to go about it (without any jailbreaks etc.)

  • Call Verizon’s Global Department at (908)559-4899 and tell them you wish to use the phone overseas
  • They will only authorize the phone’s use overseas with Apple. This does NOT unlock the phone (No Unlock Code for the iPhone either)
  • Now when you’re in a foreign country
    • Power off your phone
    • Insert the foreign SIM Card
    • Restart your phone and connect to iTunes (or do it over Wifi) to have Apple unlock (“unbrick”) the iPhone for use with the foreign carrier
    • You should be able to use the phone overseas
  • When you’re back in the US, remove the SIM Card and the iPhone will default to Verizon

I recently traveled to India and used a Vodafone Micro SIM and as you can see in the top left corner of each of the images, my Verizon iPhone is now a Vodafone IN iPhone.

  • Word of caution: Turn Off 3G and Turn Off Cellular Data, from Settings -> General -> Network
  • I lost about INR 200 in a minute when I just connected my iPhone to my PC to charge it. My PC was connected to the Internet and Vodafone billed me for data usage. (my work email is insane)
  • The rates for phone calls seem pricey. International SMS and Calls are pretty high too. I’m not sure if it’s the iPhone or just Vodafone.

So, this is just my theory (I don’t know how true it is, it’s just a theory)

  • I believe Apple has created one device (iPhone 4s) that can be used with any carrier (the hardware)
  • When you buy it (say in the US), they’ve already set the country and the default carrier (on the software/firmware)
  • Now, when you’re in a foreign country (and assuming the phone is unlocked/unbricked) you can use it with a local carrier based on the SIM
  • The Unlock Process is controlled by Apple, based on your carrier’s authorization
  • If the phone is Not Unlocked, your carrier can make HUGE Bucks and charge you exorbitant rates for foreign use
  • When you’re back in your home country (say the US), the phone will automatically default to the carrier that was set on the phone

Leave a comment

Category: Apple,Tips and Tricks

Clear certain history in p4v

Writing by on Tuesday, 24 of January , 2012 at 9:34 pm

I needed to clear user list under submitted tab and found some meta-data information under ~/.p4qt/0001Clients/WoskpaceSettings.xml

$ cd ~/.p4qt/
$ grep -IR stringToRemove *
# in my case
$ vi ~/.p4qt/0001Clients/WorkspaceSettings.xml

Leave a comment

Category: Perforce,Tips and Tricks

Resize Unity Launcher Icons in Ubuntu 11.10

Writing by on Thursday, 12 of January , 2012 at 1:27 am

Gosh! Another reason I’m not giving Ubuntu 11.10 the Best Thing yet title. Moreover, NX won’t be able to display Unity Launcher and neither would RDP!
But assuming you’re local and not remote the CompizConfig Settings Manager lets you control it.

Alright if you’ve read my earlier post on Ubuntu 11.10 Must Have Apps and things to do after installation, you probably have already installed ccsm.

  • Otherwise just install it: $ sudo apt-get install ccsm
  • Launch ccsm $ ccsm
  • Go to Desktop -> Ubuntu Unity Plugin
  • Click on Experimental Tab
  • Use the slider Launcher icon size to resize as per your liking

Leave a comment

Category: Linux,Tips and Tricks

First thing to do after installing Linux at work assuming your using DHCP with a long lease

Writing by on Wednesday, 11 of January , 2012 at 9:42 pm

Enter the damn DHCP IP Address in your /etc/hosts and map it to your hostname

$ sudo vi /etc/hosts

# Assuming DHCP that my machine pulls 10.4.11.11. and hostname is wimbledon
10.4.11.11 wimbledon

This will solve several of your problems. Some of the Linux pain points.

For me they were,
NX Nomachine was not able to connect to the server. Server Configuration Error and some weird errors in the details.
P4 Eclipse Plugin was coming back with perforce error: unable to determine client host name
In my Java product, I was getting UnknownHostExceptions
and several others…

Well there you go! This is a MUST DO after Linux installation.

Leave a comment

Category: Linux,Tips and Tricks

Shivdev Kalambi's Blog

Shivdev Kalambi is a Software Development Manager, previously a Principal Software Engineer at ArcSight/HP. With over 16 years' experience in software development, he's worked on several technologies and played different roles and contributed to all phases of projects. Non-tech activies include Ping-pong, Rock Climbing and Yoga at PG, Golf, Skiing, Swimming & a beer enthusiast.