Thread: SSH Help
View Single Post
Old 11-12-2010, 01:46 PM   #24
gemjuno
Junior Member
gemjuno began at the beginning.
 
Posts: 7
Karma: 10
Join Date: Nov 2010
Device: Kindle 3
Quote:
Originally Posted by badbob001 View Post
Complete beginning to end instructions for usbnet are not available and one has to piece the needed steps from documentation and forum posts and mix in some experimentation. Not sure why it's not as well supported as the other hacks as this doesn't seem 'more linux' than usual. But here is how I got ssh over wifi working with auth keys in a Windows environment:
  1. Install usbnet hack.
  2. Mount kindle and edit file \usbnet\etc\config
    K3_WIFI="true"
    K3_WIFI_SSHD_ONLY="true"
  3. Download and run puttygen: http://www.chiark.greenend.org.uk/~s.../download.html
  4. With (x) SSH-2 RSA selected, click Generate.
  5. Copy the text under 'Public key for pasting into OpenSSH authorized_keys file'.
    Do not be tricked by: Conversions > Export OpenSSH Key.
  6. Paste into a new file named authorized_keys.
    I previously thought authorized_keys was a folder to be created and placed my key file under that... wrong!
  7. If you plan to use the filezilla client for sftp, do not enter a key passphrase as that is not supported. Click Save Private Key to the local PC.
  8. Copy file authorized_keys to \usbnet\etc\
  9. Unmount kindle.
  10. Turn on WIFI. The kindle should obtain an IP address from your wireless access point. A quick way to find the kindle's IP is to go to Settings and then type 711. On a private WIFI network, set up a DHCP IP reservation so your kindle IP is always the same. Or just change your kindle wifi settings for a static ip address (the usbnet config file can not be used to set the WIFI ip address).
  11. On Kindle, type:
    ;debugOn
    ~usbNetwork
    ;debugOff


To connect with Putty for shell access:
  1. Configure your putty session to connect to the Kindle's IP over SSH. Under Connection > SSH > Auth > Private key file for authentication, choose the private key you saved locally.
  2. Connect to the kindle, enter username root, enter key passphrase if you used one, and you should be in. To save a step, you can set Connection > Data > Auto-login username: root.
  3. As you can tell from the login banner, if you need to change anything that is not in /mnt/us, then you will need to first mount the filesystem as RW (readwrite):
    mntroot rw
    Once you're done, you should put the filesystem back to RO (readonly):
    mntroot ro

To connect with Filezilla client to transfer files:
  1. Edit > Settings > Connection > SFTP > Add keyfile, choose the private key you saved locally.
  2. Create a new connection entry with server type: SFTP, Logon Type: normal, User: root, and blank password.
  3. You can save some time by setting your Default Remote Directory to: /mnt/us to match the directory you see when mounting over usb.
  4. Unfortunately, filezilla doesn't support sending custom commands over sftp, which makes using it annoying. See WinSCP below for a better alternative.

To connect with WinSCP client to transfer files:
  1. Create a new session filling in fields for 'Host name', User name (root), and Private Key File (WinSCP does not support private key passphrases).
  2. To add a custom command for refreshing the Kindle:
    1. Preferences > Commands > Add...
    2. Description: Refresh Kindle
    3. Custom Command: dbus-send --system /default com.lab126.powerd.resuming int32:1
    4. (x) Remote command
    5. Select a Keyboard Shortcut if you like.
    To invoke the command, either Files > Custom Commands > Refresh Kindle
    or Options > Toolbars > Custom Command Buttons or use the keyboard shortcut if defined.

Note that if you reboot your Kindle, the hack is disabled and you have to run the following commands again:
;debugOn
~usbNetwork
;debugOff

Alternatively, to have usbnet be enabled after a reboot, simply rename \usbnet\DISABLED_auto to auto and reboot.

Since you're using SSH over wifi instead of over usb, a setting of 'auto' is not so dangerous since you can still mount the kindle over usb to fix something. People using networking over usb can run into an issue where they change something on the kindle that prevents them from connecting over SSH, but since they have auto enabled, they can't mount the kindle to fix it.

FYI: if you keep the Kindle on usb (unmounted or charger), then the WIFI will stand on even when the screensaver kicks in.
I've tried this tutorial on my kindle with usbnetwork-0.28. It successfully connects with rndis adapter via usb and I was able to putty as well as filezilla into kindle with sshkey. However when I try to connect with wifi it fails to connect. I changed IPs in config file to match my network and I could only ping it. Both putty and filezilla can't access over wifi. Am I missing something here?

regards
gemjuno is offline   Reply With Quote