veteranz_guian25
Posts: 14
Joined: Mon Sep 23, 2013 3:38 pm

Send Command in terminal using Android phone..Is it POSSIBLE

Mon Dec 02, 2013 6:09 pm

Hello..i've been wondering if it is possible to connect your android phone to raspberry pi and then sends command as if it is in the LXTERMINAL, for me to execute or run programs as we do when we use LXTERMINAL.. i hope someone can help me here :D thanks a lot :D

User avatar
JRV
Posts: 270
Joined: Mon Apr 02, 2012 1:39 pm
Location: Minneapolis, MN

Re: Send Command in terminal using Android phone..Is it POSS

Mon Dec 02, 2013 6:37 pm


User avatar
DougieLawson
Posts: 39120
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: Send Command in terminal using Android phone..Is it POSS

Mon Dec 02, 2013 6:39 pm

Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

veteranz_guian25
Posts: 14
Joined: Mon Sep 23, 2013 3:38 pm

Re: Send Command in terminal using Android phone..Is it POSS

Tue Dec 03, 2013 10:30 am

Thanks for the reply guys, i'll try reading and studying more post here..

a9971256
Posts: 43
Joined: Fri Jun 07, 2013 11:02 pm

Re: Send Command in terminal using Android phone..Is it POSS

Thu Dec 05, 2013 1:17 am

SSH is easiest to use. I use JuiceSSH on Android to connect. Also, RDP woks well. Try installing xrdp via apt on your Pi (apt-get install xrdp) and then Microsoft Remote Desktop (Android/Google Play). Also, Telnet is great for if you want to get high speed communication, without as much processor usage. It is less safe. Get the server: apt-get install telnetd. JuiceSSH (Android) should be able to connect

veteranz_guian25
Posts: 14
Joined: Mon Sep 23, 2013 3:38 pm

Re: Send Command in terminal using Android phone..Is it POSS

Sun Dec 08, 2013 3:13 pm

i already used xrdp for remote desktop control for my pi, since i dont have a HDMI monitor, but know i am using a HDMI to VGA adapter which is a miracle for me having the change to find one here. My concern now is the way i can control the LXTERMINAL using an android phone, incorporate those command in buttons then make the raspi do the command itself. tnx tnx :D

1pi2much
Posts: 99
Joined: Sun Feb 24, 2013 6:58 pm

Re: Send Command in terminal using Android phone..Is it POSS

Mon Dec 09, 2013 4:25 am

Just use a terminal app on Android
Example:
Connectbot

You need to "ssh" into the pi with Connectbot. It is not LxTerminal but quite similar.
A couple of (linuxy) points.

1. If you want to open windows on the pi using commands make sure the DISPLAY variable is set
2. Android keyboards are bad at supporting all the keys you want, so install and use an appropriate keyboard
like "Hacker's Keyboard"
3. If you want to do this from outside your home network you will need to forward the ssh port on your router to the pi

--

veteranz_guian25
Posts: 14
Joined: Mon Sep 23, 2013 3:38 pm

Re: Send Command in terminal using Android phone..Is it POSS

Tue Dec 10, 2013 1:46 am

1pi2much wrote:Just use a terminal app on Android
Example:
Connectbot

You need to "ssh" into the pi with Connectbot. It is not LxTerminal but quite similar.
A couple of (linuxy) points.

1. If you want to open windows on the pi using commands make sure the DISPLAY variable is set
2. Android keyboards are bad at supporting all the keys you want, so install and use an appropriate keyboard
like "Hacker's Keyboard"
3. If you want to do this from outside your home network you will need to forward the ssh port on your router to the pi

--

Connectbot if for what sir? As basic test just to have an idea about how things works with pi wirelessly maybe i just need something to make an application run by means of sending commands to PI :) thanks by the way :D

1pi2much
Posts: 99
Joined: Sun Feb 24, 2013 6:58 pm

Re: Send Command in terminal using Android phone..Is it POSS

Tue Dec 10, 2013 2:23 am

veteranz_guian25 wrote: Connectbot if for what sir? As basic test just to have an idea about how things works with pi wirelessly maybe i just need something to make an application run by means of sending commands to PI :) thanks by the way :D
http://www.raspberrypi.org/phpBB3/viewtopic.php?t=40813

ConnectBot is a "ssh" client to allow you to "ssh" (connect) into the pi. Once you do that you have a terminal window on your phone which is sort of like lxterminal in its functionality, in that you can type commands for the pi into it. Open ConnectBout, at the very bottom choose ssh and enter a@b where a is your pi username, and b the "IP" address of the pi on your network. You will be asked for the password and then will be logged in to the pi. Type "ls" at the prompt and see the contents of your
home directory on the phone.

If the above paragraph makes no sense to you, look for how to run "Putty" (a windows ssh client) on Windows and connect to the PI. This is quite common and you might even find a youtube video on how to do this. Connectbot is like Putty for Android.

--

veteranz_guian25
Posts: 14
Joined: Mon Sep 23, 2013 3:38 pm

Re: Send Command in terminal using Android phone..Is it POSS

Sat Jul 12, 2014 4:36 am

This project is already finished and presented hehehe :) thanks guys!

User avatar
Nfarrow
Posts: 47
Joined: Sat Dec 20, 2014 1:24 am
Location: Oklahoma, USA
Contact: Website Facebook Twitter YouTube

Re: Send Command in terminal using Android phone..Is it POSS

Sat Dec 12, 2015 11:00 am

OK I really need some help here I have been looking I guess in all the wrong locations.

I can connect to my Pi with Connectbot. (done)
I am using a pubic key so no need for a password when connected to my Pi. (done)
I can't pass any variables to Connectbot from other applications such as app inventor. http://ai2.appinventor.mit.edu/

Thank you in advance for your help!!!!!!!!!!!!!!!!!

If this works I'll give you want I have created with home automation without OpenHub :mrgreen:
Twitter: @farrownick
Instagram veggievampire
I own a lot of Pis....

User avatar
Nfarrow
Posts: 47
Joined: Sat Dec 20, 2014 1:24 am
Location: Oklahoma, USA
Contact: Website Facebook Twitter YouTube

Re: Send Command in terminal using Android phone..Is it POSS

Mon Dec 14, 2015 8:56 am

Gave up on MIT's App Inventor. and switch to an android program called, "Tasker" https://play.google.com/store/apps/deta ... kerm&hl=en

Use steps below with ConnectBot and Tasker to send terminal commands with one click.

Tasker + ConnectBot can be used to execute arbitrary remote (or local, I guess, but Locale Execute is better for that) commands on a schedule.
Step 1: Setup terminal connection to send commands with ConnectBot .https://www.youtube.com/watch?v=3mPNL3dBsns
  • a) Initial setup involves simply typing in the username followed by @ and hostname.
    Example: user@111.111.111.111 or user@yourdomain.com
    b) The default port is 22. If you need to use a different port add a colon and the port number to the line above.
    Example: user@111.111.111.111:222 or user@yourdomain.com:222
    The IP address is, of course, the IP outside your firewall.
    c) Long Press for the new entry in ConnectBot and you’ll see “edit host”. Select this if you want to change any of the info above.
Step 2: Public Key Generation in ConnectBot: http://www.youtube.com/watch?v=i0wBmC-5Vu0 or http://michaelchelen.net/0f3e/android-c ... uth-howto/
  • a) Open ConnectBot
    b) Click “Manage pubkeys”.
    c) Click the Menu button on the phone.
    d) Click “Generate”.
    e) Now you have the options for key generation. For this particular purpose, I created a standard DSA key without password. I checked the “Load key on start” option. For improved security, a key size of 2048 or 4096 is now recommended. This does not affect any other steps.
    f) You will help out with the key generation by sliding your finger across the box thats presented. Generating the key takes some time, and I guess that using a slower phone will extend the generating time. The new key has been created. It is unlocked and will be used by ConnectBot automatically when connecting to a server.
    g) Copy public key you generated(long press on screen, copy public key in ConnectBot)
    h) ssh from the phone using ConnectBot type the password.
    i) type the line below in the terminal

    Code: Select all

    echo "
    Press and hold to paste your new key. you should see it on the screen. Now type

    Code: Select all

    ">>/home/$USER/.ssh/authorized_keys
    then hit enter. This echoed your key into the authorized_keys file.
    Note you may need to create the folder (.ssh) and files (authorized_keys) use command below.

    Code: Select all

    cd /home/$USER/;  mkdir .ssh ; cd .ssh;vi authorized_keys;chmod 644 .ssh/authorized_keys
    j) relog-in with ConnectBot note you now don't need a password
Step 3: Set up your connection in ConnectBot to pass commands.
  • a) Long Press and select "Edit Host"
    b) click "Post-login automation" to add the remote commands you would like to run.
    Note: Make sure there is a blank line at the end so that enter is sent after your last command. Use enter or ; to separate commands. I suggest using something like "echo hello" as a test until you are sure things are working, and "exit" at the end if you don't want to leave the connection open.
    c) click, "OK" to save
    d) Test if command works.
    Note you can have duplicate connections in ConnectBot as long as they have different aliases "Nickname". You have to rename one first (away from user@host) in order to create the second.

Step 4: Create a Tasker Task to call connectbot.
  • a) Open Tasker
    b) Create a new Task in Tasker.
    c) Add an Action. From Misc, select "Action Intent"
    The fields are:

    Action: android.intent.action.VIEW
    Cat: Default
    Data: ssh url, in the form of "ssh://user@host/#alias" (without the quotes). The alias, user and host here must match the alias you set up in Step 3 above.
    Target: Activity

    Click Test. Connectbot should open and your commands should execute on the remote host.
Some Info from:
http://android.stackexchange.com/questi ... 16344_1459
Twitter: @farrownick
Instagram veggievampire
I own a lot of Pis....

Return to “Advanced users”