Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Readers > Amazon Kindle > Kindle Developer's Corner

Notices

Reply
 
Thread Tools Search this Thread
Old 08-19-2013, 03:19 PM   #1
CapitainDerya
Enthusiast
CapitainDerya knows the complete value of PI to the endCapitainDerya knows the complete value of PI to the endCapitainDerya knows the complete value of PI to the endCapitainDerya knows the complete value of PI to the endCapitainDerya knows the complete value of PI to the endCapitainDerya knows the complete value of PI to the endCapitainDerya knows the complete value of PI to the endCapitainDerya knows the complete value of PI to the endCapitainDerya knows the complete value of PI to the endCapitainDerya knows the complete value of PI to the endCapitainDerya knows the complete value of PI to the end
 
Posts: 35
Karma: 31574
Join Date: Sep 2012
Device: Kindle 4 Non-Touch
Ant Exec(scp) on Windows Os ?

I have Ant Script like this:

<exec command="scp -i ${dev.ssh.id} test.azw2 root@kindle:/mnt/us/documents/"/>

But i am using windows os not linux, so it cant run this chunk under windows os.
I think ant using command shell of default operating system and windows's cmd hasnt got scp support. i dont know what does it means dev.ssh.id on windows.

CapitainDerya is offline   Reply With Quote
Old 08-19-2013, 03:29 PM   #2
knc1
Helpdesk Junkie
knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.
 
knc1's Avatar
 
Posts: 7,002
Karma: 6359394
Join Date: Feb 2012
Device: Too many.
Quote:
Originally Posted by CapitainDerya View Post
I have Ant Script like this:

<exec command="scp -i ${dev.ssh.id} test.azw2 root@kindle:/mnt/us/documents/"/>

But i am using windows os not linux, so it cant run this chunk under windows os.
I think ant using command shell of default operating system and windows's cmd hasnt got scp support. i dont know what does it means dev.ssh.id on windows.

http://winscp.net/eng/index.php
knc1 is offline   Reply With Quote
 
Advertisement
Old 08-19-2013, 03:34 PM   #3
knc1
Helpdesk Junkie
knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.
 
knc1's Avatar
 
Posts: 7,002
Karma: 6359394
Join Date: Feb 2012
Device: Too many.
Quote:
Originally Posted by knc1 View Post
Quote:
Originally Posted by man scp
SYNOPSIS
scp [-12346BCpqrv] [-c cipher] [-F ssh_config] [-i identity_file] [-l limit] [-o ssh_option] [-P port]
[-S program] [[user@]host1:]file1 ... [[user@]host2:]file2
Most web search engines also understand the 'man(ual)' command for *nix commands.
knc1 is offline   Reply With Quote
Old 08-19-2013, 04:15 PM   #4
ixtab
(offline)
ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.
 
ixtab's Avatar
 
Posts: 2,903
Karma: 6677559
Join Date: Dec 2011
Device: K3, K4, K5, KPW, KPW2
Quote:
Originally Posted by CapitainDerya View Post
I have Ant Script like this:

<exec command="scp -i ${dev.ssh.id} test.azw2 root@kindle:/mnt/us/documents/"/>

But i am using windows os not linux, so it cant run this chunk under windows os.
Ha! That looks familiar

For scp, see knc1's answer. Make sure to modify your %PATH% to include the path where scp resides, or - if you're lazy - just copy scp.exe to \windows or \windows32.

Quote:
I think ant using command shell of default operating system and windows's cmd hasnt got scp support. i dont know what does it means dev.ssh.id on windows.
dev.ssh.id means nothing to windows. It's defined in the ant buildfile, more specifically, here (line 4 of build.xml). Which includes build.properties, where dev.ssh.id is defined on line 33. So you'll need an appropriate build.properties file (or any other means to define that value).

Finally, you will of course need an appropriate key file (man ssh-keygen), and the Kindle has to trust that key in its authorized_keys file. Example on Linux:

Code:
ixtab@mbp:/tmp$ mkdir derya
ixtab@mbp:/tmp$ cd derya/
ixtab@mbp:/tmp/derya$ ls -la
total 68
drwxrwxr-x  2 ixtab ixtab  4096 Aug 19 20:54 .
drwxrwxrwt 42 root  root  61440 Aug 19 20:54 ..
ixtab@mbp:/tmp/derya$ ssh-keygen -C "CaptainDerya's Kindle developer key" -f id_derya
Generating public/private rsa key pair.
Enter passphrase (empty for no passphrase): (***press ENTER***)
Enter same passphrase again: (***press ENTER again***)
Your identification has been saved in id_derya.
Your public key has been saved in id_derya.pub.
The key fingerprint is:
9a:7a:2e:83:6e:3e:04:99:1d:c5:cd:68:d2:73:0f:28 CaptainDerya's Kindle developer key
The key's randomart image is:
+--[ RSA 2048]----+
|   +.=           |
|  E B =          |
| + = o o         |
|+ .     .        |
| .      S        |
|  .    o         |
| . .  o          |
|  + o..          |
| +o..=.          |
+-----------------+
ixtab@mbp:/tmp/derya$ ls -la
total 76
drwxrwxr-x  2 ixtab ixtab  4096 Aug 19 20:56 .
drwxrwxrwt 42 root  root  61440 Aug 19 20:54 ..
-rw-------  1 ixtab ixtab  1675 Aug 19 20:56 id_derya
-rw-r--r--  1 ixtab ixtab   417 Aug 19 20:56 id_derya.pub
ixtab@mbp:/tmp/derya$ cat id_derya.pub 
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDu/xUUW9vhF6spgd5nI8WmRxuXj/pM+fVgG+tK/CKrksbvhhX8QY4yLHvIpX5ufWYT6l5g8B+dYuCYzfCZC03Ry0AsS8fPBFMOdZcwaElBGAQ/K/GvKXUWJSNLcbiuYIXzNg1U7VMNvQNM/GHS9VsXztBwicqVOiQJpmQLq9PxWGm5hzZCqv6USQ9ZqNSSL9mkW5hkmHN7XJBt01Yvl4Jt7yxuERpRYeFJaE81xOxqKRYl3c2h0tqbqIbN73kBJmXAy0qj4+ZWKpRCnm4cSvsN2M6HsgRHrxiuYsCp1+GF8yJIwD++Bb6WOXmq+DbXxQ9Vcc3PQdxSG/N5oO4yVIz/ CaptainDerya's Kindle developer key

ixtab@mbp:/tmp/derya$ scp id_derya.pub root@kindle:/mnt/us/usbnet/etc/authorized_keys
Warning: Permanently added 'kindle,192.168.15.244' (RSA) to the list of known hosts.


Welcome to Kindle!

root@kindle's password: (***(any) password required, just press ENTER***) 
id_derya.pub                                                                                                                                                                                              100%  417     0.4KB/s   00:00    
ixtab@mbp:/tmp/derya$ ssh -i id_derya root@kindle 'echo "logged in without password"; whoami'
Warning: Permanently added 'kindle,192.168.15.244' (RSA) to the list of known hosts.


Welcome to Kindle!

logged in without password
root
Note: the last login attempt did not require a password, because it used public-key authentication using the (private) key id_derya. That worked because the corresponding public key id_derya.pub was added to the Kindle's authorized_keys before(*). This means that calling ssh -i <that-private-key> or scp -i <that-private-key> will do whatever it is supposed to do without asking for a password from now on. Which is what you want in an automated build file.

PS: (*) Well actually, the authorized_keys files has been overwritten to contain only that public key. But that's a detail.
PPS: If anybody feels like this is useful enough as a short HOWTO to end up on the Wiki or index, feel free to link to it -- no, I'm not too lazy, I'm not sure if and where it fits.


EDITED TO ADD:
I also have this line in my /etc/hosts:
192.168.15.244 kindle

which is why "root@kindle" works. Otherwise, use "root@192.168.15.244".

And finally, a minor note: My .ssh/config looks like this:
Code:
Host 192.168.15.244
	StrictHostKeyChecking no
	UserKnownHostsFile /dev/null

Host kindle
	StrictHostKeyChecking no
	UserKnownHostsFile /dev/null
This is to prevent SSH from bitching if I plug a different Kindle device with a different host key. It will silently accept any host key for host "192.168.15.244" or "kindle". The only minor annoyance is the constant "Warning: Permanently added 'kindle,192.168.15.244' (RSA) to the list of known hosts." thing.

Last edited by ixtab; 08-19-2013 at 04:32 PM.
ixtab is offline   Reply With Quote
Old 08-19-2013, 04:32 PM   #5
NiLuJe
BLAM!
NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.
 
NiLuJe's Avatar
 
Posts: 5,257
Karma: 5220787
Join Date: Jun 2010
Location: Paris, France
Device: Kindle 2i, 3g, 4, 5w, PW & PW2; Kobo H2O
@ixtab: Linked in the USBNet doc, thanks .
NiLuJe is online now   Reply With Quote
Old 08-19-2013, 04:37 PM   #6
knc1
Helpdesk Junkie
knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.
 
knc1's Avatar
 
Posts: 7,002
Karma: 6359394
Join Date: Feb 2012
Device: Too many.
Well, it need not use the "... -i indentity-file ... root@kindle ..." parts of the command, that can all be included in a nickname (shortcut) entry in your ~/.ssh/config file.

The "HowTo" is to be found with the "filter by prefix" feature.

Also, NiluJe's most recent USBnet can assign unique MAC addresses, based on the Kindle's serial number, to each end of the cable.

Which in-turn allows your workstation's network automation identify the "Kindle of the Moment" and assign a unique set of IPv4 address (and a unique set of IPv6 address will be auto-configured by the normal IPv6 discovery process).

Which in-turn can mean putting an end to the "I found a duplicate key" business.

It also means (since IPv6 address are globally unique, without any NAT) my Kindle and "talk" to your Kindle (or twobobs, or ...).
That "HowTo" is a WIP.
knc1 is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Tutorial Kindle ssh/scp with the USBnetwork package knc1 Kindle Developer's Corner 13 02-13-2013 03:17 PM
SSH/SCP -ing into the enTourage eDGe AlPe enTourage eDGe 3 04-16-2012 06:04 PM
Update Library After Scp Books Without reboot qinbill Kindle Developer's Corner 15 11-08-2011 04:25 PM
iLiad Need dbclient for scp... grayfox iRex Developer's Corner 2 02-11-2008 03:40 PM


All times are GMT -4. The time now is 06:37 PM.


MobileRead.com is a privately owned, operated and funded community.