I am wondering if there's a way to read the current GPS coordinates via SSH using SSHelper as SSH server.

I came accross some similar threads:

I managed to run the SSH server and connect to it. So far, I have tried to run the dumpsys location command over ssh, which gives me the following:

Permission Denial: can't dump LocationManagerService from from pid=27381, uid=10192 due to missing android.permission.DUMP permission

Does that command only work with adb? If yes, is there another way of retrieving GPS coordinates over ssh, i.e. using some shell commands?

I don't have root, and I'm not an app developer. Thanks!

  • 1
    Ah, sorry! you are running the command from SSHHelper app, and to do this your APK should have the permission DUMP of course, which is not possible without root in your case, have you tried Command line from your PC, I have no issue with non-root devices using "adb shell dumpsys location | find "Last Known Locations"
    – M. A.
    Commented Nov 19, 2019 at 18:39
  • 1
    Ah okay, so the DUMP permission is only possible for system apps or apps signed with the platform key, right? So the SSHelper app can't have it, unless i root my phone and move it to the system partition, is that correct? In that case, I wonder if there are other ways of retrieving GPS data via SSH in non-root environments. Since I want to use SSH as a wireless protocol, adb via USB is not an option for me in this case.
    – soelderer
    Commented Nov 19, 2019 at 18:57

1 Answer 1


While I found no solution using SSHelper, it is indeed possible using Termux and the Termux-API. No root is required.

After installing the Termux app, one has to install the Termux-packages openssh and termux-api:

$ pkg install openssh
$ pkg install termux-api

I also had to install the Termux-API app from Playstore or F-Droid to get it working.

The sshd config can be edited as desired and can be found at $PREFIX/etc/ssh/sshd_config.

Set a password for SSH authentication (or, alternatively and even better, public key authentication with ssh-keygen and ssh-copy-id):

$ passwd

Next, start the ssh server:

$ sshd

To stop the server:

$ pkill sshd

In my case it's on port 8022 per default. One should now have access to the Termux-API commands via ssh. termux-location retrieves GPS data as JSON. For example:

$ ssh [email protected] -p 8022 termux-location
   "latitude": xx.xxxxxxxxxxxxxxxx,
   "longitude": yy.yyyyyyyyyyyyyyyy,
   "altitude": zzz.zzzzzzzzzzzz,
   "accuracy": 64.31999969482422,
   "vertical_accuracy": 192.0,
   "bearing": 301.9921875,
   "speed": 0.4399999976158142,
   "elapsedMs": 8,
   "provider": "gps"





You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .