How to use blackberry-connect to Enable SSH Access

by BlackBerry Development Advisor on ‎01-17-2012 03:03 PM (9,545 Views)

Summary

 

This article applies to the following:

  • BlackBerry® Tablet OS
  • BlackBerry® Native SDK
  • BlackBerry® WebWorks™ SDK for Tablets
  • BlackBerry® SDK for Android™ Apps

Details

 

The BlackBerry Tablet OS allows for remote access using SSH for the purpose of testing and debugging applications.  For security reasons, the SSH daemon does not run all the time.  It must be enabled through the use of the blackberry-connect appliction, which is included in the BlackBerry® Native SDK, BlackBerry® WebWorks™ SDK for Tablets and BlackBerry® SDK for Android™ Apps.

 

Note:  If you wish to access the private sandbox area of your application, ensure that you have installed a debug version of your application.  You will not be able to access an application's directory on a release build of the application.  The device will also need to be put into Developer Mode to access that location.

 

 

Create Your Public and Private Key

 

First you'll need to create a public and private RSA 4096 key.  Follow the steps below that pertain to the OS you are using.

 

Unix Based Machines

 

On Unix based machines you can create this using ssh-keygen using the following command:

 

ssh-keygen -b 4096 -t rsa

 

Windows Based Machines

 

Windows based machines can create the key using PuTTYgen.  To do so use the following steps.

 

  1. Download and run PuTTYgen.
  2. Select SSH2-RSA.
  3. Set number of bits in generated key to 4096.
  4. Press generate.
  5. Click Save private Key as id_rsa.ppk.
  6. Do not use the public key button!
  7. Copy and paste the public key that puttygen shows into a text editor and save it as id_rsa.pub in the same location you saved id_rsa.ppk. Delete all the characters after == at end of file. Do NOT remove the ==. Make sure you copied the "ssh-rsa " at the beginning of the key.

 

Enable the SSH Daemon

 

You'll need a Debug Token installed on your BlackBerry PlayBook to continue.  If you don't have one installed already, use your SDK of choice to create and deploy a Debug Token.  If you are not sure how to do this use the Code Signing Self Help Form to locate the instructions for your SDK of choice.

 

Once you have your debug token install and public and private keys ready you can eanble the SSH daemon on the BlackBerry PlayBook by running blackberry-connect.  Closing blackberry-connect will halt the SSH daemon, so leave it running for the duration of your testing.

 

blackberry-connect YOUR_DEVICEIP -password YOUR_DEVICE_PASSWD -sshPublicKey id_rsa.pub

 

If the connection was successful, you should see the following output:

 

Info: Connecting to target 169.254.0.1:4455
Info: Authenticating with target 169.254.0.1:4455
Info: Encryption parameters verified
Info: Authenticating with target credentials.
Info: Successfully authenticated with target credentials.
Info: Sending ssh key to target 169.254.0.1:4455
Info: ssh key successfully transferred.
Info: Successfully connected. This application must remain running in order to use debug tools. Exiting the application will terminate this connection.

 

You are now ready to connect using your SSH client of choice.  Login using devuser when you connect.  Unix based machines can use ssh application to do so.

 

ssh devuser@YOUR_DEVICE_IP_ADDRESS

 

Windows users can connect using putty.  When configuring your SSH connection in putty, expand SSH on the left hand navigation tree, select Auth and then click on the Browse button and select the private key (id_rsa.ppk) you created earlier.

 

 

Disable the SSH Daemon

 

Once you are finished with your SSH session, just close blackberry-connect to disable the SSH Daemon, preventing any future SSH connections from being accepted.