Skip to content

SSH into Linux

May 10, 2013

I am always wondering how difficult/easy it is to perform a SSH login into Linux system. At last I managed to allocate some time to studies about SSH and test on my laptop running Ubuntu 12.04LTS and then embedded Linux board running Ubuntu distribution. The SSH client that I use is ‘connectBot’ on my android phone. After a couple of hour studies and testing finally I managed to get it to work, which as shown below:

  1. As usual, before any actual steps, below are some reference links that I found useful.
    1. https://help.ubuntu.com/community/SSH/OpenSSH/Configuring
    2. https://help.ubuntu.com/community/SSH/OpenSSH/Keys
    3. http://michaelchelen.net/articles/android-connectbot-ssh-key-auth-howto.html
  2. To enable Ubuntu allow user login into system with SSH, an SSH server is required, I have tried using OpenSSH. Begin by installing OpenSSH server:
    1. sudo apt-get install openssh-server
  3. Once this is install, we can start login into the system. You can skip steps 4 and directly goes to steps 5 to test if the openssh-server is working
  4. To further enhance the security and avoid unauthorizes people login into the system, it is recommended to use SSH keys as the password instead of usual login/password style login. This is done as below:
    1. edit file /etc/ssh/sshd_config as below:
      1. PasswordAuthentication no
    2. restart ssh server
      1. sudo /etc/init.d/ssh restart
    3. Creating SSH keys pairs
      1. mkdir ~/.ssh
      2. chmod 700 ~/.ssh
      3. ssh-keygen -t rsa
        1. Generating public/private rsa key pair.
          Enter file in which to save the key (/home/b/.ssh/id_rsa):
          Enter passphrase (empty for no passphrase):
          Enter same passphrase again:
          Your identification has been saved in /home/b/.ssh/id_rsa.
          Your public key has been saved in /home/b/.ssh/id_rsa.pub.
      4. cat id_rsa.pub >> authorized_keys
      5. Inside ~/.ssh folder there will be an id_rsa file, this file will be require to transfer to phone as shown below
  5. On my android phone, install connectBot apps.
  6. If you using SSH keys following steps 4, then
    1. transfer id_rsa file into phone.
    2. In connectBot, look for ‘Manage Pubkeys’
    3. Then select ‘Import’ and select id_rsa file
    4. There should be an id_rsa entries appear, touch on the red lock and key in password that you key in in steps 4)iii). If the password is correct, the lock will be turning into green color.
  7. Launch connectBot
    1. select ‘ssh’
    2. login using format as shown: login-name@IP
    3. Enjoy!

 

As I said in earlier of the page, I first tried on laptop and then repeat the same steps for embedded linux boards, both works the same way. The only section I get stuck was on embedded linux when I tried to login using connectBot, I did not unlock the public keys, as I assumed it is unlocked previously. Then I was greet by messages ‘Your host doesn’t support password or keyboard-interactive authentication’. Once unlock id_rsa keys ‘again’, I was able to login without problem.

Advertisements

From → Linux

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: