Jump to content

Using DropBear and SSH


Recommended Posts

Guest ptruman
Posted (edited)
Hey Forum,

I've been trying to find some information about how to use DropBear and SSH on the Hero. I've searched MoDaCo and XDA forums and have found some guides (that assume a lot of Linux knowlege), but nothing definitive for the Hero and that start from the basics. From what I can gather (correct me if I'm wrong) is that DropBear allows you to connect to your hero via a WiFi network and allows you to access a terminal remotely?

A few questions:

1. What does SSH and DropBear allow the user to do (assumption above!)?

2. Does anyone have a URL to (or could post) a good guide which would take me through set-up and use?

3. What would be the best free software to use on Windows 7 and Linux (Ubuntu)

Thanks in advance.

The saying goes that if you don't already know what SSH is/does, then you don't need it.

Your assumption however, is correct - basically it's a "Secure SHell" method of accessing your phone, similar to telnet, but encrypted. Dropbear is just the program (daemon/service) providing the SSH facility on the phone.

If you have your phone on WiFi, then download putty (on Windows, google for it) and setup a connection to your phones IP on port 2222

Login as root, with the password shown on your settings/about page - lo, you have shell access to your phone - and can do whatever you might need to do with a shell.

Including screw your phone sideways if you don't know what you're doing.

Personally, I use ConnectBot so I can shell into the phone, from the phone itself. Quite handy.

Edited by ptruman
Posted

your assumption is correct so far. dropbear is the server part of the ssh thing. you need a client on your pc, let's say putty for windows and the default openssh client for linux (i can't think of a distro that does not have it by default, at least not one that you would use as a desktop operating system. ubuntu does have it.)

a url which can help you find a guide might be this: http://www.google.com/ , ssh was not invented for android, it has been out there for a long time now. tbh, if you don't know what it is you probably won't use it at all. there are several drawback when using ssh instead of usb-cable and adb, especially when it comes down to modding the system/rom. i personally use ssh countless times a day at work (server admin) and at home (have three pcs running ubuntu), and i couldn't imagine what a PITA my work would be without ssh, but i fairly use it with the hero at all. i like having it, but usually find myself using the usb-cable anyway because i need to copy some larger files (new rom :D ) or something else (reboot into recovery), for which the wifi is not suitable for.

Guest Dan Mullen
Posted
your assumption is correct so far. dropbear is the server part of the ssh thing. you need a client on your pc, let's say putty for windows and the default openssh client for linux (i can't think of a distro that does not have it by default, at least not one that you would use as a desktop operating system. ubuntu does have it.)

a url which can help you find a guide might be this: http://www.google.com/ , ssh was not invented for android, it has been out there for a long time now. tbh, if you don't know what it is you probably won't use it at all. there are several drawback when using ssh instead of usb-cable and adb, especially when it comes down to modding the system/rom. i personally use ssh countless times a day at work (server admin) and at home (have three pcs running ubuntu), and i couldn't imagine what a PITA my work would be without ssh, but i fairly use it with the hero at all. i like having it, but usually find myself using the usb-cable anyway because i need to copy some larger files (new rom :D ) or something else (reboot into recovery), for which the wifi is not suitable for.

I use PuTTY - it's a free SSH client: http://chiark.greenend.org.uk/~sgtatham/putty/download.html

Posted
Not having a go at you, but to say "if you don't already know what SSH is/does, then you don't need it" is a bit condecending IMHO. I don't know what it is (at the moment), thats why I asked for help with it.

might sound this way, but it isn't. if you know your way around a linux terminal you know what ssh is. if not then you should learn the basics, it makes no sense to start at the top and go to the bottom. or would you want to learn programming first and then how use a mouse and keyboard?

so many times it is better just to leave it alone when you don't know what you are doing, because you can break something when playing with it. even worse, you could open your phone to the whole world, just happened on the iphone. thousands of iphones were hacked, because an ssh server was started with a default password on a hacked rom. and some things aren't explained in two sentences, sometimes it takes more to comprehend.

A quote I often tell my students is: "He who asks is a fool for five minutes. He who does not ask is a fool forever".

Thanks for the reply, it will at least give me somewhere to start from....

so you answer ALL your students questions? they don't ever use books* at all? i don't think it is asked to much to look into wikipedia and google before asking here, nobody will flame you when asking something that is not a worldwide networking and security standard since 1995...

with all due respect: think about teaching your students to think for themselves, and to do research for themselves. there will be a time when they can not ask you anymore for anything...

*google

Guest ptruman
Posted
agent-5 @ Dec 7 2009, 14:59 : Not having a go at you, but to say "if you don't already know what SSH is/does, then you don't need it" is a bit condecending IMHO. I don't know what it is (at the moment), thats why I asked for help with it.

It wasn't meant to sound condescending, it was an honest answer. In fact I thought my post answered your questions, pointing out if you didn't know what you were doing with root shell access, you could cripple your phone, even inadvertently.

Given that you appear to have now removed (blanked) *all* your posts on the forum, it seems you got a bit miffed - hopefully not just over that! :\

Guest stevenz
Posted (edited)

If possible, try and use 'adb shell' instead, much quicker due to the physical connection.

Otherwise, to get your IP you can install "MyIP" from the marketplace, and get your SSH password from the "About Phone -> Build Number" in the settings. Then just use;

ssh root@IPADDRESS -p 2222

then enter the password when prompted. (Replace IPADDRESS with your phones IP obviously, e.g. 10.0.1.6 )

If you're on Windows then PuTTY is the SSH tool of choice. Linux and OS X should have native SSH tools preinstalled.

In theory you should be able to SSH in over the GSM network, but most of the APNs I have the option of using will block unsolicited incoming traffic, so YMMV.

Once connected, you can replace any 'adb shell xxxxx' commands with just whatever xxxxx is.

Edited by stevenz
Guest stevenz
Posted

Assuming the functionality is in MCR, how does one enable dropbear sftp?

Cheers,

Steve.

Guest toxic-hero
Posted
Assuming the functionality is in MCR, how does one enable dropbear sftp?

ssh is enabled by default from MCR 2.7 on.

(for beginners) i suggest using winSCP client on windows.

Guest richteas
Posted (edited)
If possible, try and use 'adb shell' instead, much quicker due to the physical connection.

Otherwise, to get your IP you can install "MyIP" from the marketplace, and get your SSH password from the "About Phone -> Build Number" in the settings. Then just use;

ssh root@IPADDRESS -p 2222
then enter the password when prompted. (Replace IPADDRESS with your phones IP obviously, e.g. 10.0.1.6 ) If you're on Windows then PuTTY is the SSH tool of choice. Linux and OS X should have native SSH tools preinstalled. In theory you should be able to SSH in over the GSM network, but most of the APNs I have the option of using will block unsolicited incoming traffic, so YMMV. Once connected, you can replace any 'adb shell xxxxx' commands with just whatever xxxxx is.
Only to add to these comments, it is also possible to connect to the phone using the USB connection and adb, thus avoiding hassle with APN blockage. As per (Tweaks), you can execute the following adb command at the Windows or the Linux command line of the computer your phone is attached to:
adb forward tcp:9999 tcp:2222
After that, use your ssh client (e.g., putty, as pointed out above) to connect to your localhost IP adress 127.0.0.1, at port 9999, and you will be able to log into your phone. Using the syntax lined out above, the command would be
ssh [email protected] -p 9999

I do this as an alternative to typing commands at the phone keypad, e.g. to run Debian on my Hero.

Edited by richteas
Guest volatile_ink
Posted (edited)

Is there a shutdown and reboot command that can be run from a script or from ssh?

Thanks.

Edited by volatile_ink
Guest ptruman
Posted
Is there a shutdown and reboot command that can be run from a script or from ssh?

Thanks.

Type reboot (or adb reboot) and see what happens ;)

Guest volatile_ink
Posted (edited)
Type reboot (or adb reboot) and see what happens ;)

Getting 'not permitted' with reboot. Is there a program which could be run from the shell to shutdown/reboot? 

Edited by volatile_ink
Posted
Getting 'not permitted' with reboot. Is there a program which could be run from the shell to shutdown/reboot? 

with the usb cable plugged in type in a command prompt:

"adb shell reboot"

you can pass "recovery", "bootloader" or "-p" (power off).

Guest volatile_ink
Posted (edited)

   Can shutdown with ADB shell no problem. I'm trying to shutdown with ConnectBot on the phone itself."poweroff -f" shuts-down the phone but the "-f" option states that its for a 'Force Power Off (don't go through init). poweroff on its own does not do anything. Is the -f option safe to use?  

Edited by volatile_ink

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.