3

I want to run scripts on an Ubuntu PC from my Android phone just with a tap, no passwords or other stuff.

Things I did so far: I managed to connect via SSH to the PC, but I cannot configure a public-key authentication (I'm using CM9, for what it matters). I could create a rsa key on my phone (and stored it on the server) but it's like it's not using it when connecting, so I tried using the "ssh -i" flag but then I get an error that the string is too long. ConnectBot rsa authentication works well, but I cannot use it to run scripts. I also tried installing dropbear but I stopped as soon as I needed to compile stuff, because I could not find a complete guide, or they are mostly describing the opposite process (install an ssh server on Android). To run the scripts I use "Script Manager - SManager" that allows the creation of widgets, but so far it's always asking for the password.

Can you suggest a proper way to use pub key or any alternative solution?

Thanks!

P.S. I know this has already been partly discussed here: Where to add SSH keys to allow connections to remote server on Android? But it does not work and I cannot comment that question.

teocomi
  • 131
  • 1
  • 2
  • Whats the problem with ConnectBot? Have you tried "Post-login automation" option? – Peter Mar 07 '13 at 09:30
  • ConnectBot does work! But it doesn't have the functionality of SManager to create widgets that run custom scripts. So each time I would have to open the app and type in the code to run the script... – teocomi Mar 07 '13 at 14:01
  • What version of ConnectBot are you using? I'm running Android 4.1.2 and ConnectBot 1.7.1 and using ConnectBot widget lets you directly establish a connection from your home screen to the desired host. If you also configure "Post-login automation" should also execute something when connected to the host. – Peter Mar 07 '13 at 15:45
  • ConnectBot 1.7.1, Android 4.0.4 and now Widget :( But thanks for the hint! – teocomi Mar 07 '13 at 19:44
  • SManager (market description and website) nowhere states it's capable of using keys, so that might be the reason. What you could try is something like using sftp://user:pass@machine:port/path/to/file. But keep in mind that this way the password is visible. And no guarantees that it works. – Izzy Aug 28 '13 at 22:44
  • I am still having the same problem on CM11. Does that mean that SSH is broken on cyanogenmod? – jfa Nov 14 '14 at 19:36
  • Also, did you look up the error "string is too long"? Does that indicate the key or the path? – jfa Nov 14 '14 at 19:37

1 Answers1

1

When you provide the key (using -i switch), you should provide the path to the file, not the key itself - are you entering the file path?

Curious Mind
  • 111
  • 3