As I use Textastic on the iPad to edit my xml files, I have to mail them to myself so i can then upload them from a PC (via the Vera UI) as Vera does not support a direct transfer via FTP/SFTP.
Does anyone know of a way I could move the files i’ve edited on an IPAD to Vera?
I have some SSH apps on the Pad too, so could I do a work around uploading the file to a Linux NAS I have and then carry out an SSH file transfer to Vera (not being Linux savy could someone advise on the steps/cmd line entries) ?
The goal is to avoid the need for a PC…
I have updated the subject line to reflect the discussion on SSH file transfers should anyone find it of use interest when searching the forums.
#!/bin/sh
for f in "$@"; do
scp "$f" root@my-vera-hostname:/tmp
f="${f##*/}"
ssh -x root@my-vera-hostname pluto-lzo c /tmp/"$f" /etc/cmh-ludl/"$f".lzo
done
The trick is in getting the scp/ssh commands to not prompt you for a password. You do this by generating a public/private keypair and putting the public key into /etc/dropbear/authorized_keys. You’re going to struggle horribly with this and I’m not going to be much help. Fortunately this isn’t Vera-specific so you have all of Google to help you.
I have a vague idea what it’s trying to do, but it seems to suggest all of it runs on Vera, however I cannot reference any files stored on the iPad so I would need to use Textastic to send my updated xml files to a share on my NAS //192.168.x.xx/media/Vera
Therefore i assume that script would need to be created on the NAS and then be run from there??
How would it need to change if I want to send the file from the NAS to Vera? Or does Vera go off and get it ??
It gave me the option of accepting some form of fingerprint? Although @futzle’s example suggests that the file format i’m want to transfer needs to be .lzo?
Host ‘192.168.111.111’ is not in the trusted hosts file.
(fingerprint md5 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx)
Do you want to continue connecting? (y/n) y
/usr/bin/dbclient: Connection to root@192.168.111.111:22 exited: No auth methods could be used.
[/code]
Subsequent attempts just show this.
/usr/bin/dbclient: Connection to root@192.168.111.111:22 exited: No auth methods could be used.
I’m assuming it’s password related (and from what i can tell i can’t include the password in the line enty) so will keep digging and try an use @futzle’s script.
parkerc, you are going in the right direction. Yes, I develop on a Unix machine, so I run the script directly on that, but in your case you could run it on the NAS, assuming that it has a shell prompt (most do).
Getting around the auth errors is probably the last hurdle. The general process is that you create a keypair (Google “ssh-keygen”). Put the private key on the NAS and put the public key on the Vera in the file /etc/dropbear/authorized_keys (create it if needed). There’s more but I will drip-feed it to you to avoid overload.
I use iSSH on the iPad to do shell sessions. It can generate SSH keypairs too.
since you are copying from the NAS to Vera.[/quote]
In that example I was trying to run the scp request on my Vera to see if it could go off and get the file on the NAS (which is 192.168.111.111) , I just wasn’t sure which is the best way round to do it…
I work in IT but have had little exposure to the details of pub/priv keys, so this is a good learning curve…
Finally if I move the XAP.xml to a temp directory on Vera, how do I then move it into the /etc/cmh-ludl/ so it can be referenced as it needs to be compressed? Is that another special cmd line entry?
[ol][li]I created the folder as suggested. (mkdir etc/dropbear/authorized_keys)[/li]
[li]On the NAS I created the public/private keys (ssh-keygen -d)[/li]
[li]Then with the public and private keys are saved to ~/.ssh/id_dsa.pub and ~/.ssh/id_dsa, respectively. I next copied the public key to Vera (scp ~/.ssh/id_dsa.pub root@192.168.1.xxx:.etc/dropbear/authorized_keys[/li]
[li]assuming all was well, I tried to copy a file over to Vera (scp /home/Share/I_XAP.xml root@192.168.1.xxx:/etc/) BUT it still prompts me for the Vera root password ?[/li][/ol]
In summary, it looks like I can transfer a file from my NAS to Vera (hooray!!) thanks for your help on that, although everything I read suggests that it should not prompt me for a password now the NAS and Vera has a key ?? (Any thoughts)
Additional - I also noticed that Textastic will allow me to point to a public key on Vera when doing SSH, theoretically allowing me to do a direct transfer, but i put the following location in (etc/dropbear/authorized_keys) it fails, telling me it cant find the file.
Now I assume that’s either because I don’t have the private key on my iPad ?! Although delving a bit deeper - it doesn’t look like Textastic supports SCP so that’s probably the reason…)
Textastic has problems with SCP. I contacted the developer last year and he said a future release would fix things, but no luck yet, despite at least one release since then.
authorized_keys is a file, not a folder. It contains all of the public keys that are allowed to connect without a passphrase, concatenated one per line. Since you only have one public key you can just rename id_dsa.pub to authorized_keys on the Vera and put it in the /etc/dropbear directory.
Do i need to rename id_dsa.pub to authorized_keys ?
/etc/dropbear# ls
[b]authorized_keys [/b] dropbear_dss_host_key dropbear_rsa_host_key id_dsa.pub
I’ve copied the public key file (above) across from the NAS to Vera again and retried an scp transfer request (scp /home/Share/test.xml root@192.168.1.xxx:/etc/etrayz/), but it still prompts for a password ?
/etc/dropbear# ls
authorized_keys dropbear_dss_host_key dropbear_rsa_host_key
And tried the copy again and it works !! No password prompt - Thanks futzle .
To help my learning…
Why does the file need to be renamed to “authorized_keys” ?
If I want to link to another PC what do I call the other one? E.g, authorized_keys2 ?
[quote=“parkerc”]Why does the file need to be renamed to “authorized_keys” ?
If I want to link to another PC what do I call the other one? E.g, authorized_keys2 ?[/quote]
It contains all of the public keys that are allowed to connect without a passphrase, concatenated one per line.
So you just append the second public key after the first one, with a text editor. A public key is just one (long) line of text.
I don’t know what design decisions in OpenSSH led to them making authorized_keys a file rather than a directory. That’s just the way it is.
Best Home Automation shopping experience. Shop at Ezlo!