TimeLinux1

Wednesday, February 27, 2013

ssh from a browser using Ajaxterm

The Ajaxterm package allows you to open a simple lightweight ssh terminal from within your browser to a remote node.


To install Ajaxterm issue the following commands:

 root@node1# wget http://antony.lesuisse.org/ajaxterm/files/Ajaxterm-0.10.tar.gz
 root@node1# tar zxvf Ajaxterm-0.10.tar.gz
 root@node1# cd Ajaxterm-0.10
 root@node1# ./ajaxterm.py

Then point your browser to this URL : http://localhost:8022/

If you get 'login incorrect' error, make sure you have an entry for your pseudo-terminal in /etc/securetty file. So if your pseudoterm is 'pts/0' make an entry for that in /etc/securetty file. You can verify the pts from /var/log/secure file as well.


How to enable Password-less ssh in a cluster?

If you are an admin to a clustered environment and frequently need to remote login (via ssh) to the cluster from your local node (eg laptop) OR from one node in the cluster to other nodes in the same cluster, you may have wondered --"Wouldn't it be nice to not have to provide password every time you login to a remote system?" Well to answer that its possible to enable what is called password-less ssh (secure shell) session between the nodes and it can be achieved in 3 easy steps.

1- Generate public keys on each node
2- Copy the public key of every node to every other node in the cluster in their 'authorized_keys' file
3- And test it out.

In the following example, we are taking a two node cluster and want to enable password-less ssh between the two nodes in the cluster. 
Node 1 IP Address -  10.10.80.102
Node 2 IP Address -  10.10.80.103

On Node 1:
Step 1:  Generate Public keys

[root@10.10.80.102 ~]# ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa): 
Created directory '/root/.ssh'.
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
e8:f8:fe:c7:f2:c6:89:3d:51:78:df:6f:f1:a3:90:91 root@10.10.80.102
The key's randomart image is:
+--[ RSA 2048]----+
|                 |
|                 |
|           .     |
|       .  . +    |
|      . S  E . . |
|     o    . o ...|
|    . .  = =    +|
|     .  o O .  .+|
|     .o..=.. ....|
+-----------------+
[root@10.10.80.102~]# 

Then go to ~/.ssh directory and verify the public key file is present.

[root@10.10.80.102 ~]# cd .ssh
[root@10.10.80.102 .ssh]# ls -l
total 8
-rw-------. 1 root root 1675 Feb 27 02:53 id_rsa
-rw-r--r--. 1 root root  394 Feb 27 02:53 id_rsa.pub
[root@10.10.80.102 .ssh]# 

Step 2:
Copy the public key of every node to every other node in the cluster in their 'authorized_keys' file

Then copy over the public key file (of Node 1 ie 10.10.80.102) over to Node 2 (10.10.80.103 in this case) in the file called ~/.ssh/authorized_keys with permissions 600. A handy tool called ssh-copy-id does it for you as shown below.

[root@10.10.80.102 .ssh]# ssh-copy-id -i id_rsa.pub 10.10.80.103
The authenticity of host '10.10.80.103 (10.10.80.103)' can't be established.
RSA key fingerprint is 06:80:d2:e9:05:c8:28:4d:bb:b3:09:5a:c1:47:bd:f4.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '10.10.80.103' (RSA) to the list of known hosts.
root@10.10.80.103's password: 
Now try logging into the machine, with "ssh '10.10.80.103'", and check in:

  .ssh/authorized_keys

to make sure we haven't added extra keys that you weren't expecting.

[root@10.10.80.102 .ssh]# 

Step 3:
Test it out

[root@10.10.80.102 .ssh]# ssh root@10.10.80.103
Last login: Wed Feb 27 02:49:08 2013 from 10.250.0.54
[root@10.10.80.103 ~]#  [[[ no password asked ]]]
Now just repeat steps 1, 2, 3 on all nodes on your cluster. And you are all set !!



Sunday, February 17, 2013

Logitech Bluetooth Keyboard K810 with Fedora 17

So received my brand new Logitech Bluetooth Illuminated Keyboard K810 from Amazon a few days ago.
Had been wanting a wireless keyboard for a long time to unclutter the desktop workspace at home.
[[BTW I also went one further and got a wireless mouse too (Verbatim Wireless Mini Nano Travel Mouse 97470) and I write about it little later in this article.]]

What is good and appealing about this keyboard (besides its wireless feature) is its Illumination feature.
In low light conditions, a gentle light comes through each key, meaning all the keys are visible in the dark with the letters themselves glowing. This is important for me as I often work late and in the dark room (so not to disturb others while they sleep) and so having an illuminated keyboard is convenient, enhances typing experience by minimizing typos and also looks cool. Infact, I bought my Sony Vaio S series laptop mainly for the Illuminated keyboard feature. Having an external keyboard that is wireless and illuminated at the same time simply enhances the computing experience.

Ok now that we gloated a bit about the product features, lets talk tech.
As you already read, the keyboard is wireless and it communicates to the laptop via Bluetooth. So obviously, you would want your Bluetooth service turned on (some people turn it off to save laptop battery).

Now my concern about buying this keyboard (its not cheap btw, even on Amazon it costs about $90), was that I only use Linux OS (Fedora 17) and nowhere on Amazon website or even on Logitech's website does it state that this keyboard is compatible with Linux OS. Anyway, based on the notion that Bluetooth is a wireless standard and not any OS specific featu[root@ms-vaio ~]# rpm -qa | grep bluere, I went ahead and ordered the keyboard. I took the risk--if it did not work because of missing or incomatible drivers, I would have returned it back.

Fedora has its own inbuilt Bluetooth drivers and you can configure its settings via the System Settings > Hardware Settings > Bluetooth.
Once check Bluetooth on and also turn on Wireless Logitech Bluetooth keyboard, the system will try to detect the keyboard and 'pair' it. The bad news is the default Bluetooth driver in Fedora 17 wont be able to pair the keyboard. You can find out what Bluetooth driver you have installed by running the following command on a terminal:
[root@ms-vaio ~]# rpm -qa | grep blue

A little research on the web shows that the driver you need is called 'blueman'.
To install Blueman simply use yum (as root user on a terminal window):

[root@ms-vaio ~]# yum install blueman -y

And query the rpm database again for bluetooth -- see my example below:


[root@ms-vaio ~]# rpm -qa | grep blue
bluez-cups-4.99-2.fc17.x86_64
gnome-bluetooth-libs-3.4.2-1.fc17.x86_64
bluez-4.99-2.fc17.x86_64
pulseaudio-module-bluetooth-1.1-9.fc17.x86_64
blueman-1.23-5.fc17.x86_64
gnome-bluetooth-3.4.2-1.fc17.x86_64
bluez-libs-4.99-2.fc17.x86_64
gnome-shell-extension-remove-bluetooth-icon-0.3.0-1.fc17.noarch
bluez-hid2hci-4.99-2.fc17.x86_64
[root@ms-vaio ~]#

Then start the blueman applet from Gnome under Applications. Its called 'Bluetooth Manager'.
Dont select the app called 'Bluetooth' app under 'Services'--thats the default Bluetooth app from Fedora and doesnt work for this keyboard.
Note: to get to Gnome activities, simply point the mouse to your left top corner of the screen.

Then in the Blueman applet, click Setup in the menu bar > Select Input service. It will automatically detect your keyboard and pair it. And you are all set!
Bottom line is even though the neither Logitech nor Amazon does not mention compatibility with Linux/Fedora anywhere, this keyboard DOES work on Linux.
Linux is such a cool platform that you can make anything work on it yourself just with a few commands and some reverse-engineering. No other OS gives you that Freedom. Enjoy!!

PS: Infact, this keyboard supports 3 wireless devices at the sametime. You can pair your tablet, mobile phone and laptop all at the same time just by pairing them to the 3 bluetooth buttons on the keyboard.
Also, Like I said before I also got the Verbatim Wirelesse Mini Nano Travel mouse to increase the 'Wireless' experience. But that one works on USB technology (not Bluetooth), and therefore is much easier to setup and works out of the box. Plug and Play.

Saturday, February 16, 2013

VirtualBox Shared Folder Fedora 18 Guest on OSX Host

In todays article we are going to review the steps required to share folders between two Operating Systems running VirtualBox (VB) on the same machine.

First what is VirtualBox?

VirtualBox (VB)is a very useful desktop virtualization tool from (previously) Sun Microsystems (and now Oracle).
To download VB you can go to https://www.virtualbox.org/ .

In our setup the Host OS is OSX 10.8 and the guest OS (running inside VB) is Fedora 18. Both are 64Bit OS in our case.


[[Note: The article assumes that you have a similar setup and that you have already installed VB and Fedora guest on top of the OSX host. If not, then for installation steps, go here for a text tutorial or here for a video tutorial before proceeding further.]]


We have a folder on our host (OSX) Desktop called 'documents' that we want to access from within the Fedora guest at a mount point directory called '/home/mrinal/doc_osx'


The first thing we need to do is to define the shared folder.

For that click the 'Devices' menu on the top of the VB window, and then click 'Shared Folders...'
This opens a popup where you define the host folder to share (in our case called documents) and the path for the same.

The next thing to do is to install the VBGuest Additions to the Guest OS (Fedora 18).

This is because the default installation of VB doesnt come with the necessary modules for sharing folders, mouse integration, display integration etc.

So, to do that open a terminal window on your Fedora guest and su - to root

$ su -
password:
#  yum install dkms binutils gcc make patch libgomp glibc-headers glibc-devel kernel-headers kernel-devel

This downloads and installs the necessary kernel modules and mounts the iso for the guest addition

In my case, the  Guest Additions were mounted under this path by default:


/run/media/mrinal/VBOXADDITIONS_4.2.6_82870/   

[[Note:  you should be able to see it in the output of mount / df -Th 

Also, the correct version of VBox Additional modules for Fedora 18 is 4.2.6.xyz ]]

So I went in that directory,

[root@fedora18 ~]# cd /run/media/mrinal/VBOXADDITIONS_4.2.6_82870/

And ran the shell script to install the Guest Additions as follows:


[root@fedora18 VBOXADDITIONS_4.2.6_82870]# ./VBoxLinuxAdditions.run 

Verifying archive integrity... All good.
Uncompressing VirtualBox 4.2.6 Guest Additions for Linux..........
VirtualBox Guest Additions installer
Removing installed version 4.2.6 of VirtualBox Guest Additions...
Removing existing VirtualBox DKMS kernel modules           [  OK  ]
Removing existing VirtualBox non-DKMS kernel modules       [  OK  ]
Building the VirtualBox Guest Additions kernel modules     [  OK  ]
Doing non-kernel setup of the Guest Additions              [  OK  ]
Starting the VirtualBox Guest Additions                    [  OK  ]
Installing the Window System drivers
Installing X.Org Server 1.13 modules                       [  OK  ]
Setting up the Window System to use the Guest Additions    [  OK  ]
You may need to restart the hal service and the Window System (or just restart
the guest system) to enable the Guest Additions.

Installing graphics libraries and desktop services componen[  OK  ]

[root@fedora18 VBOXADDITIONS_4.2.6_82870]# 

[[Ensure you didnt receive any errors or 'FAILED' status messages, if you do, then look at the log files under /var/log directory. The log file is vboxadd-install.log]]


Assuming all went well so far, now the only thing remaining to do is to mount the shared folder on your guest.

You can do that only as root (or sudo)

[[As Root]]

[root@fedora18 ~]# mount -t vboxsf -o rw documents /home/mrinal/doc_osx

[[As regular user mrinal via sudo]]

[mrinal@fedora18 ~]$ sudo mount -t vboxsf -o rw,uid=1000 documents /home/mrinal/doc_osx

Also:

Not recommended to automount in /etc/fstab as it hangs the guest at boot.
So if you reboot, you need to mount the share manually again. Perhaps you can automate via an init script in /etc/init.d directory.

Anyway, hope you found this article useful...



Tuesday, February 5, 2013

OEM vs ODM Explained..

Many have asked this question - What is the difference between an OEM and an ODM?

So here it is in a compact form

OEM and ODM are terms that we come across in the design and manufacturing industry and people remain unsure of the difference between both terms as they appear to be similar. These are in fact categorization for the manufacturing companies and the resellers. This article will help the readers in differentiating these terms by finding more about their functions and responsibilities.

OEM
Original Equipment Manufacturer (OEM) is a company which produces a product according to parameters given by another company. The product is sold to the company which gave order and then it is sold under a trade name given by the purchaser. OEM has the facilities to manufacture products, but it is not involved in Research and Development and manufactures products according to the specifications of the company which places the order.
Examples will be Quanta, FoxConn, Compal.

ODM
ODM is Original Design Manufacturer which refers to a company which conceives and manufactures the product. It sells the product then to another company which sells it under the own trade name. An ODM company can begin only if it knows the concept and the function of the product and it has the facility for research and development.
Examples will be Asus, Acer, Dell.

Now it is clear that an ODM company is the one which designs and manufactures products according to the ideas conceived by them, while the OEM Company works like a businessman who accomplishes the specifications of design given by another company. As ODM companies make their own products, they have of course more negotiating power and are able to ask for more prices than OEM companies.
An advantage which OEM gives to the business owner is that they get the ownership of a brand without setting up infrastructure for production because they get finished products from manufacturers. ODM is innovative and is involved in R and D and this is why they need to wait to get profits until their products are approved by industry and bought by the interested parties.