127.0.01

127.0.0.1
127.0.0.1

While going through #dgplug’s July 16th log I ignored service sshd start and went ahead trying to ssh into testacc which is a test user account. No surprise I encountered an error as follows.

ssh: connect to host 127.0.0.1 port 22: Connection refused

Lessons here is to try not to act smart by skipping instructions.

This reminds me I could replace 127.0.0.1 with localhost and also with my hostname. Previously, on my Arch Linux box I have always append my hostname in /etc/hostname file but since moving on to Fedora and lack of documentation I used systemd to set hostname like hostnamectl --set-hostname <hostname> and didn’t bother messing up with any config files.

This is a nice moment in space and time continuum to catch up on 127.0.0.1. According to Wikipedia, localhost literally means this computer. localhost is associated with IP address 127.0.0.1/8.

I wish there was enough time to go through man pages of all the command we use.

July 16th Log

How to Manage Multiple SSH keys on Fedora KDE?

Passwords are cumbersome to remember and annoying if you have to remember and present several of them several times per session. I started using SSH keys in order to remove the need of regularly entering password whenever I push updates to my github repository or make changes on my server.

This guide assumes that you are using Fedora's KDE flavor. If you are not then you better be. In order to be verbose I have following ssh packages installed on my system.

rpm -qa | grep ssh
fuse-sshfs-2.4-5.fc20.x86_64
ksshaskpass-0.5.3-6.fc20.x86_64
openssh-6.4p1-4.fc20.x86_64
openssh-clients-6.4p1-4.fc20.x86_64
libssh-0.6.3-1.fc20.x86_64
libssh2-1.4.3-9.fc20.x86_64
openssh-server-6.4p1-4.fc20.x86_64

We will be using several pieces of technology and their short definition are as follows.

ssh – You probably know this but according to man pages it is an OpenSSH SSH client.

ssh-agent – It is the program that runs in background and manages your multiple keys.

ssh-add – This small utility basically unlocks your ssh keys and adds it to ssh-agent.

ksshaskpass – This KDE program will provide a password prompt, through pinentry-qt, in your KDE environment.

That out of the way, it is important that you make sure ssh-agent is auto-started and running on your system. If ssh-agent is running the following command will return a process ID.

echo $SSH_AGENT_PID

You also need to make sure that ksshaskpass is set to ask for passphrase of your ssh keys. The assumption is that it already is. You could run following command to make sure of that.

echo $SSH_ASKPASS

How to generate keys? There are a few strategies that you could employ to have a sane ~/.ssh folder. Mine is to just add the server name to the key file.

ssh-keygen -t rsa -f ~/.ssh/test_ssh_key_1 -C "yours@yours.com"
ssh-keygen -t rsa -f ~/.ssh/test_ssh_key_2 -C "yours@yours.com"
ssh-keygen -t rsa -f ~/.ssh/test_ssh_key_3 -C "yours@yours.com"

ssh-keygen will generate a key of type rsa and save it to file ~/.ssh/test_ssh_keys_# with your email id as a comment. You could have a long list of keys that can be easily identified as github_id_rsa.pub or bitbucket_id_rsa.pub, etc.

You could start using them right away by adding them to ssh-agent by following command.

ssh-add ~/.ssh/test_ssh_key_1

It will ask for your password and then any command you type in your terminal will be executed by your server without login password prompt.

We want to have access to our keys all the time during a session and in all terminal sessions. So we need a script to do that. A little note here is if your read SSH’s documentation $SSH_ASKPASS is only triggered if $SSH_ASKPASS is set and you are not in a terminal session. The easiest way to save your passwords in kwallet so that you are not asked them ever again is by running ssh-add command through KRunner as follows.

ssh-add ~/.ssh/test_ssh_key_1
ssh-add ~/.ssh/test_ssh_key_2
ssh-add ~/.ssh/test_ssh_key_3

You will be asked to enter password for each key. Make sure to check remember password and all your password will be saved in your encrypted kwallet.

Now we need a script to automate aforementioned commands which you will save as ~/.kde/Autostart/ksshaskpass.

#!/bin/sh
export SSH_ASKPASS=/usr/bin/ksshaskpass
ssh-add ~/.ssh/test_ssh_key_1 &lt; /dev/null
ssh-add ~/.ssh/test_ssh_key_2 &lt; /dev/null
ssh-add ~/.ssh/test_ssh_key_3 &lt; /dev/null

These commands will will be executed at the beginning of each session for which passwords are already saved in kwallet and /dev/null is used to suppress any warnings.

Also make sure to correct file permission of the auto-start script.

chmod 755 ~/.kde/Autostart/ksshaskpass

You log-out and log-in and you have access to all your keys without entering a single password.

You can easily check which keys are unlocked by and being maintained by ssh-agent by running following command.

ssh-add -l

Update:- It is a good idea to chmod ~/.ssh folder, key files, config, and authorized_keys on server.

chmod 700 ~/.ssh
chmod 600 ~/.ssh/config ~/.ssh/authorized_keys ~/.ssh/test_ssh_key_1

#dgplug

I have officially decided to become a hipster and join #dgplug. My knowledge of computer science has serious gaps in both technical level and social level due to lack of formal training in computer science. I am hoping #dgplug could fill up that space.

I came to know about #dgplug through an ambitious post by Kushal Das on Planet Fedora. I actually came to know about several of these Indian open source communities through Planet Fedora and mailing list. I followed through and registered to the course.

The training started late June. We have come to learn a lot of stuff including how to communicate on IRC and mailing lists, basic Linux commands, vim text editor, file system hierarchy, reStructuredText, and personal lives of a few developers and past participants of #dgplug.

As far as communication, basic Linux commands, and file system hierarchy are concerned, I am already well versed in it. I also got to know how to use Git as a result of previous MOOC I took.

I have been a Markdown fan. Markdown is such a simple tool which makes commenting on internet a pleasurable experience. I knew about reStructuredText but Github, Reddit, and several websites that I use already use Markdown so it became a natural choice to me. As we looked into reStructuredText in #dgplug I came to realize it is pretty handy and probably more powerful than Markdown. I plan to seriously pursue it in future.

I am personally moved by beginning of developmental careers of several contributors who are participating as mentors. You have to read IRC logs to get the full juice. I think it is nice of the contributors to spend their free time teaching us.

One suggestion I could give #dgplug maybe is to post class notes in form of slides beforehand so that folks can work on them at their own pace and sort out their problems. It can take too much time to participate in the IRC sessions daily. Although from now on IRCs will be thrice a week.

In the end #dgplug makes me wish if there was a local lug I could go and participated personally.

Purpose of Blogging

I have been blogging for many years. It goes back to the time I wanted to write secretly on the web, yeah. As far back as I can remember my official blog started with writing film reviews. I wasn’t popular at all but I did it consistently and I enjoyed it.

I think about purpose of blogging over and over. My personal hero Matt Mullenweg’s blog has always been a source of inspiration. His blog has a linear flow where he posts anywhere from a line, a quote, or a full post. Sometimes I think that when someone visits my website I would want it to be a place to tell the visitor everything about me. I want a mix of static page and a blog of constant thought experiment. So far I have failed to materialize it.

One of the problems I have with blog that run page after page is that their is no way to tell what is important for visitors to know. To be realistic some posts are going to be purely bad and some are going to be nicely written and the flow of blog should not disrupt that. I think same problems are valid for new aggregating sites like Hacker’s News and Reddit. Unless you are a regular reader you will miss things. And on missing things I think google does the best job of finding relevant information better than any of us.

This little mental exercise makes me realize that I should create a website that is primarily a blog but a top or bottom or side panel could bring the visitors to the right information.

Auto Rickshaw Ride in India

Auto Rickshawphoto credit: pabak sarkar via photopin cc

I went from Surendra Palace to Bima Kunj this afternoon. I was asked to to pay Rs 200. It didn’t sound right, so, I asked the auto-rickshaw-driver to reduce the price by Rs 50. He replied that how can I ask him for Rs 50 discount. He agreed to Rs 190. I saw his fellow auto-rickshaw-drivers laughing for some notorious reasons I am not aware of. When I came back from the Bima Kunj to Surendra Palace an hour later, I asked the same question to another auto-rickshaw-driver and he replied that he would charge me Rs 120.

Just because you sound non-familiar everyone in the town would sell you crap at a very high rate. To play devil’s advocate, auto-rickshaw-drivers, vegetable vendors, etc. are the poorest of poor in India. They have big families and they tend to be open to idea of mischieves and are illiterate. They have greater requirement of the funds.

Truthfully, it is less about losing money but more about being victimized by the poorest of the poor. Nothing could justify lying. Maybe a little bit of lying is fine. Maybe you make a few rupees off each customers for your greed but outright robbing them is just so wrong.

It makes me want to not travel across India. One thing is sure I will be fooled and I will be robbed.

State of Affairs

IndiaNarendra Modi has become the Prime Minister of India. I have to say I had my doubts. This year a difficult election. The Sonia-Rahul-Manmohan led UPA failed to do anything meaningful for past 5 years. You see I had to use three names just to say who actually is the leader. Congress party failed at everything they pursued. And it was clear that people were going to boot them out but I didn’t expect people throwing Congress out of the window. There were no indication that BJP could pull what they did in the election. Congress certainly played a good role in its dismissal.

Narendra Modi even if not complicit in Gujarat’s massacre he failed to put a full stop on the mass murder. With these doubts and general doubts of all politicians being corrupt Modi became the Prime Minister in a blaster win. His tone sounded like he could be a powerful leader at the center. He seems focused and polarizing in his party.

Development in India has been disastrous. You come back to you home town find same folks in same shops in same market only with their broken shops. The time has not been very favorable to them. For past 10 years, the government has failed to build road which connect my town to two of the major cities in the region. The road being a prominent national highway.

You go for a run in the morning and you will find 100 boys and 1 girl exercising in the stadium. We will obviously be hateful towards the opposite gender in such a disparity.

photo credit: betta design via photopin cc