Thread: SSH Help
View Single Post
Old 10-25-2010, 03:36 PM   #8
badbob001
Evangelist
badbob001 ought to be getting tired of karma fortunes by now.badbob001 ought to be getting tired of karma fortunes by now.badbob001 ought to be getting tired of karma fortunes by now.badbob001 ought to be getting tired of karma fortunes by now.badbob001 ought to be getting tired of karma fortunes by now.badbob001 ought to be getting tired of karma fortunes by now.badbob001 ought to be getting tired of karma fortunes by now.badbob001 ought to be getting tired of karma fortunes by now.badbob001 ought to be getting tired of karma fortunes by now.badbob001 ought to be getting tired of karma fortunes by now.badbob001 ought to be getting tired of karma fortunes by now.
 
badbob001's Avatar
 
Posts: 448
Karma: 1042602
Join Date: Sep 2009
Device: Kindle 3 (US 3G)
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
Quote:
INFO: One issue you'll face is that after transferring files over, the Kindle doesn't know to refresh its index as it does when you unmount from usb. Alt-Z will usually show updates in the Pictures folder but does nothing for Documents. From a ssh connection, you can run the following to trigger a refresh: "dbus-send --system /default com.lab126.powerd.resuming int32:1". If you mix this command with Alt-Z, you may get duplicates so just stick to the command. Also for some reason, new documents may show up but not shown as the newest, so sort by title to find them.
Quote:
INFO: If you just installed an usbnet update and can no longer SSH to your Kindle over WIFI even though you can ping it, you should restart the Kindle. This may happen if your Kindle restarts from an update with the usb cable attached.
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.

Quote:
INFO: if you keep the Kindle on usb (unmounted or charger), then the WIFI will stay on even when the screensaver kicks in.

Last edited by badbob001; 11-17-2010 at 02:37 PM. Reason: Added WinSCP section, Refresh command, Edits
badbob001 is offline   Reply With Quote