Related
After many hours of yelling and screaming at my linux dev box, I finally got everything working so I can cross compile and port in theory any application to Android. Obviously the first step was to get SSHd working on the phone, specifically dropbear since it is much simpler than openssh.
Follow these exactly and you should have a running dropbear daemon.
If you have already rooted your phone and have busybox on your phone, I HIGHLY recommend walking through this to make sure you have done everything that is listed. There are a few things you must do for dropbear to work correctly
NOTE: I have not been able to login yet! I have been unable to find the password data for the phone. It is asking for a password when you login with root. And yes, I have tried no password and also common ones along with "android". All result in me still being locked out.
With that out of the way, lets begin. I am assuming you have a virgin G1. I will walk you through the entire procedure.
PART 1 - ROOTING YOUR PHONE
1. Download pTerminal from the marketplace or from http://android-dls.com/files/src.com.poidio.terminal.apk. If you choose to download the file from the link provided, download it on the phone by going to this forum post and long holding the link.
2. Run pTerminal and type
Code:
cd /system/bin
and then
Code:
telnetd
3. Connect the phone to your wifi and go back to pTerminal and run:
Code:
netstat
This will show you the local ip of the G1.
4. Using your favorite telnet client, connect to your phone on the default telnet port 23.
PART 2 - BUSYBOX
5. Welcome to root access We now need to get busybox on the phone. Again, pull up this thread on your phone and long hold the following link: http://staulkor.com/android/busybox.xxx. Dont mind the .xxx extension. Browser wont let you download certain extension types. The xxx will be renamed to asc automatically.
6. We now need to remount /system because it is currently read only. After that we will copy busybox off the sdcard and put it in the bin directory and then make it executable. Go to your telnet app and type:
Code:
mount -o remount,rw /dev/block/mtdblock3 /system
dd if=/sdcard/download/busybox.asc of=/system/bin/busybox
chmod 4755 /system/bin/busybox
cd /system/bin
busybox cp -s busybox cp
You now have access to the cp command. You can use that syntax to make a symlink to any of the busybox commands. MAKE SURE you do NOT overwrite the default symlinks. They have special syntaxes and you will most likely break things.
PART 3 - DROPBEAR
7. Now that you have busybox and the cp command (you MUST have the cp command), we need to create a directory.
Code:
mkdir /system/etc/dropbear
This is where the encryption keys will be kept.
8. Now you have the required directory, you can download dropbear and dropbearkey.
Dropbear - http://www.staulkor.com/android/android-dropbear-0.51.rev1.xxx
Dropbearkey - http://www.staulkor.com/android/android-dropbearkey-0.51.rev1.xxx
Again, download them on the phone by long pressing each link and saving it.
I am using version 0.51 of dropbear. The rev1 is so you know what revision of the android port it is. Changes may have to be made and recompiled and I want to make sure you guys can tell the versions apart short of an md5 hash
9. Now that they are downloaded, they again change the .xxx extension to .asc automatically. We need to move them to /system/bin and make them executable.
Code:
cp /sdcard/download/android-dropbear-0.51.rev1.asc /system/bin/dropbear
cp /sdcard/download/android-dropbearkey-0.51.rev1.asc /system/bin/dropbearkey
chmod 4755 /system/bin/dropbear
chmod 4755 /system/bin/dropbearkey
10. Now we have to create the encryption keys. If you do not create them, dropbear will not run at all.
Code:
dropbearkey -t rsa -f /system/etc/dropbear/dropbear_rsa_host_key
dropbearkey -t dss -f /system/etc/dropbear/dropbear_dss_host_key
11. Now dropbear is totally installed. You can run it by typing:
Code:
dropbear
To check if it is running, type:
Code:
ps
and to make sure it is listening, type:
Code:
netstat
and look for the 0.0.0.0:22 LISTENING
At any point if you have to kill dropbear, you will need to run ps, find the PID and then do "kill <pid>" without the brackets of course.
12. Now we can try to login to the phone. I run Vista on my main box, so I use putty for my ssh/telnet client. If you use linux/osx and type:
Code:
ssh [email protected]<ip address of G1>
You should be able to connect to the phone and it will ask for a password.
13. ?????????? -- We need to be able to login. I cant find any password data on the phone. I am looking for that data to see if there is even a password, or if it would be possible to create a password, or a new user, or something.
Enjoy!
Credits:
Rooting the phone - http://android-dls.com/forum/index.php?f=15&t=151&rb_v=viewtopic
Busybox - http://android-dls.com/forum/index.php?f=15&t=153&rb_v=viewtopic
And big thanks to DarkriftX for making those tutorials and helping the cause
What about public key authentication? Have you tried that?
BTW, awesome news!
No, I have not tried that. Ill give it a shot
running
is it fine to just leave dropbear running? or should we kill it when not in use
I dont know. I think it should be fine, but it may eat some extra battery. We will need to test battery life with it running. My guess is that it probably wont impact the battery life.
k
i'll be sure to keep informed about mine too
thanks staulkor, you even followed though with the walk-though. now its time for you to catch some Z's you desserved it.
ugh
i'm stumped
what's with all the fish names lol if anyone is trying brute force add a list of fish names hehe. i'm going to have to crash i have tried everything i know how and looked through almost everyfile i could think to look through.
sry if this is a dumb qustion
can someone explain wat exactly running dropbear on the g1 allows us 2 do? im just a little confused
Nothing yet since we cant login, but once we can, ssh brings with it a lot of goodies like tunneling
Howdy Boys
A few notes I made whilst following the walkthrough
Code:
busybox cp -s busybox cp
this was failing without me cd'ing over to /system/bin on the telnet terminal
not sure why, since it is in the binaries file, but, whatever
secondly
I think you meant
Code:
cp /sdcard/download/android-dropbearkey-0.51.rev1.asc /system/bin/dropbearkey
not
Code:
cd /sdcard/download/android-dropbearkey-0.51.rev1.asc /system/bin/dropbearkey
enough pety stuff, to the meat and potatoes
Just because there is a prompt for a password, doesnt mean the password exists, or even if that user exists
for proof try to
Code:
ssh [email protected]<ip address with an SSH server>
now I may be 1337, but definitely not 1337 enough to have made my own password on your 'puter
so, the bigest thing would be assigning a password with good ol passwd
since staulkor and the gang has been great enough to get busybox over there, we need to get a user with which we have the password, I chose the aptly named user "ssh"
so I ran
adduser ssh -HD && passwd ssh
but that returns
[CODE[passwd: unknown uid 0 [/CODE]
meaning, as far as I know, that its trying to change the password, but it does not have one for user 0 (aka root), so its looped into an error
so I did
Code:
busybox echo root:x:0:0:root:/root:/ > /etc/passwd
to add the root user to the passwd file, allowing for it to define passwords
note - I am not sure what the home dir and the shell directory (/system/bin/sh?) should be officially, but this seems to work, for the time being
from there passwd works
Code:
passwd: no record of ssh in /etc/shadow, using /etc/passwd
Changing password for ssh
New password:
Bad password: too weak
Retype password:
Password for ssh changed by root
the bad password error comes up even with a 16 alphanumeric, so im not sure wtf thats about
ssh still does not work when I try, however
Code:
busybox login ssh[/]
returns a password prompt, which accepts when entered correctly, which takes me to an ash shell, as prompted to in the /etc/passwd file
I hope that helps some.
Im pretty sure you could set the root password, now that its empty set, but I haven't studied the boot procedure
and I do not want to bork up something that mounts as root expecting no password.
Id rather have a locked phone than an unlocked brick =]
anyone have the guts to try?
Wow, good info Thanks for catching my typos. I have edited the first post with the corrections.
Looks like you are getting somewhere with applying a password. The only reason I said to ssh to [email protected]<ip address> was because I was assuming that would be the account I do know that you can put [email protected]<ip address> and it will still try to authenticate, but I think root is a reasonable assumption.
Anyways, I am off to bed soon, so android development will cease until tomorrow after class.
My plan is to configure dropbear to take public authentication keys instead of passwords.
I am pretty sure it will work, but I just need to confirm.
Looks like somebody beat you to it!
http://www.upche.org/doku.php?id=wiki:android4
This is only confirmed on the emulator. I guess install dropbear on the emulator (watch out, when you close the emulator, you will have to reinstall everything again the next time it boots up) and then try this out and see if you can login.
I have been messing with public key authentication for about an hour now. It is accepting it, but saying "Permission denied (publickey)". I am assuming its saying that because I honestly have no idea where the authorized_keys file goes. I put it in /system/etc/dropbear thinking it will look in the same spot where the private keys are for the server, but no luck.
The only setting in the options.h file before I compile is to enable pub key auth (and yes, it is enabled). I guess tomorrow I will hunt through the code looking to see how it looks for this file.
staulkor said:
I have been messing with public key authentication for about an hour now. It is accepting it, but saying "Permission denied (publickey)". I am assuming its saying that because I honestly have no idea where the authorized_keys file goes. I put it in /system/etc/dropbear thinking it will look in the same spot where the private keys are for the server, but no luck.
Click to expand...
Click to collapse
make sure authorized_keys2 has permissions of '600' (chmod 600 authorized_keys2). That *might* be why dropbear is *****ing...
Although, this assumes you are putting it in the correct place - usually ~/.ssh/... but if $HOME isn't defined... *shrug*
Good luck!
CleverJake37 said:
Howdy Boys
...
so I did
Code:
busybox echo root:x:0:0:root:/root:/ > /etc/passwd
...
from there passwd works
Im pretty sure you could set the root password, now that its empty set, but I haven't studied the boot procedure
and I do not want to bork up something that mounts as root expecting no password.
Id rather have a locked phone than an unlocked brick =]
anyone have the guts to try?
Click to expand...
Click to collapse
You can clone the root user id and you don't need to touch the "root's line" or his password for anything...
echo root:x:0:0:root:/root:/ > /etc/passwd
echo justme:x:0:0:justme:/justme:/ >> /etc/passwd
So you have a second user with the same uid, with a different password on shadow or passwd file. This way, when you enter the username justme with justme's password, you should get a root shell based on the uid. This works normally on Fedora and Debian, it should work on android too (even with busybox...)
Nada
that didnt do it
though that is a neat trick
thanks, im gonna use it in teh future
=]
so I ran
Code:
dropbear -F -E
to monitor to stout and not background it
I tried sshing in via [email protected] and [email protected]
and its returned
Code:
[792] Nov 07 02:48:57 login attempt for nonexistent user from 192.168.0.11:47790
confirming my earlier beliefs
=[
I also tried the -s option in dropbear to allow for passwordless logins, but to no avail
return from
Code:
ssh -v 192.168.1.8
Code:
OpenSSH_5.1p1 Debian-3ubuntu1, OpenSSL 0.9.8g 19 Oct 2007
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: Connecting to 192.168.0.8 [192.168.0.8] port 22.
debug1: Connection established.
debug1: identity file /home/patrick/.ssh/identity type -1
debug1: identity file /home/patrick/.ssh/id_rsa type -1
debug1: identity file /home/patrick/.ssh/id_dsa type -1
debug1: Remote protocol version 2.0, remote software version android-dropbear_0.51
debug1: no match: android-dropbear_0.51
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.1p1 Debian-3ubuntu1
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-cbc hmac-md5 none
debug1: kex: client->server aes128-cbc hmac-md5 none
debug1: sending SSH2_MSG_KEXDH_INIT
debug1: expecting SSH2_MSG_KEXDH_REPLY
debug1: Host '192.168.0.8' is known and matches the RSA host key.
debug1: Found key in /home/patrick/.ssh/known_hosts:1
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering public key: id_rsa
debug1: Authentications that can continue: publickey
debug1: Trying private key: /home/patrick/.ssh/identity
debug1: Trying private key: /home/patrick/.ssh/id_rsa
debug1: read PEM private key done: type RSA
debug1: Authentications that can continue: publickey
debug1: Trying private key: /home/patrick/.ssh/id_dsa
debug1: No more authentication methods to try.
Permission denied (publickey).[\CODE]
seems like its attempting to read the key, but its not able to for some reason
I think the biggest issue is creating a userbase that dropbear can read from
I was googling around for solutions to the 'nonexistent user' error and came across this post: http://www.mail-archive.com/[email protected]/msg00193.html
Basically it looks like dropbear logins will fail if there is no /etc/nsswitch.conf and associated libnss* libraries. I haven't had a chance yet to test this solution myself, but I thought I'd point it out in case it can help someone else.
Ah, what a crap...
I downloaded the sources of dropbear, it gives this message when some function "getpwnam((char*)username)" returns NULL. It's system function or something, I mean, it's not a part of dropbear. Description from Internet: "getpwnam - get passwd record given user login name". Searching around, I guess is looking in /etc/passwd for the record for given username.
I tried to create /etc/passwd file and /etc/group, and I am even able to use /system/bin/login to login as root (with password) or as a user created by 'adduser', but all that does not affect anyhow to dropbear error message.
So, I runned out of ideas :-/ Would be good to compile dropbear from sources to know for sure what it is doing, but sounds too complicated. Actually, people who compiled the android version should know how it works...
Ububtu for you HTC Desire HD
In June 2010, XDA zedomax got Ubuntu 9.04 running on Nexus One, tutorial is available at this thread:
http://forum.xda-developers.com/showthread.php?t=718952
[email protected] then continued studying the tutorial and worked out a way to make Ubuntu 9.04 running better, smoother and cause less errors, here's hes post:
http://forum.xda-developers.com/showthread.php?t=815532
Recently HTC_Linux team has released version 0.3 of their Ubuntu image, compare to the original guide provided by zedomax, the v0.3 release is based on the latest Ubuntu 10.10 and is a WIP, V0.4 is currently undergiong testing.
What benefits will you get from running Ubuntu 10.10 on your DHD (at least):
1. Fully functional Linux terminal, with all standard Linux command line utilities
2. Fully functional desktop browser Firefox 3.6.13
3. Ability to compile and run native Linux applications
4. Bunch of graphical Internet and utility applications as shown in the screenshots
As promised, here is a little guide to get Ubuntu Desktop running on you DHD, The image used is a WIP and has been built for use with the HTC HD2. the scripts, from the above threads modified by my self to work with the DHD
Credits:
Thanks to the great XDA-developers community.
Thanks to Zedomax for providing the original tutorial of running Ubuntu on Nexus One.
Thanks to HTC_Linux team for creating the optimised Ubuntu 10.10 image file.
Basic requirements
A Rooted HTC Desire HD (Ace)
A MicroSD with minimum 3GB free space
A Custom kernel wit LoopBack support (I have attatched mine )
The Below Ubuntu.rar which contains ubuntu.img & the required scripts (modified by my self)
An android terminal emulator -from the market
Android VNC - from the market
If you're using Froyo App2SD, move all your applications which are on SD card back to Internal Storage and ensure FroYo A2SD install location is set to internal(1) by typing #"pm setInstallLocation 1" into your android terminal. If you fail to do so, you won't be able to enter Ubuntu.
LeeDrOiD V2.0.6 custom Kernel - 21/02/11 5:25pm GMT(MultiUpload)(2.46mb)
MD5# ba511a40ef17352b9a8a35013eb16674
Ubuntu.rar (Torrent)
How to
1. Extract the Ubuntu.rar that you have just downloaded to an "ubuntu" folder on the root of your SD card.
2. Open your Android Terminal Emulator
3. Type “cd sdcard/ubuntu” (enter)
4. Type su to go to superuser mode
3. Type “sh ubuntu.sh
4. If you see “Type 'bootubuntu' to boot Ubuntu”, then you're almost there!
5. Type “bootubuntu” (enter)
6. You should now see “"[email protected]:/#"” Congratulations! Now you're running Ubuntu 10.10
Whenever you want to enter Ubuntu again, simply cd to the ubuntu directory and type “bootubuntu” (enter) in your Android Terminal.
To properly exit Ubuntu, you must type exit from the Ubuntu terminal.
If your Android terminal application gets killed by Android system (i.e. you lost Ubuntu terminal), you need to go back to Android terminal, type “exit” (enter), that will properly unmount Ubuntu.
Very often you can get “loop device busy” error when exiting from Ubuntu, in that case, type “exit” (enter) multiple times (it's harmless to run the“exit” script multiple times, don't worry). If still you get “loop device busy”error, don't worry, just ignore it.
Loading the GUI (Gnome desktop) 1. Install “android-vnc-viewer” from Market (free)
2. Enter Ubuntu terminal
3. Make sure that you have network connection (Wi-fi recommended)
4. type “apt-get update” (enter), and wait till it finishes
5. type “apt-get install tightvncserver” (enter) and answer “y” to the question
6. After you have installed tightvncserver, type “cd /bin” (enter)
7. Type the following commands (all are case-sensitive!):
“cat > x” (enter)
“rm -r -f /tmp” (enter)
“mkdir /tmp” (enter)
“chmod 777 /tmp” (enter)
“export USER=root” (enter)
“export XKL_XMODMAP_DISABLE=1” (enter)
“vncserver -geometry 1024x800” (enter)
(enter)
(At this point you will need to configure "vol-" as Ctrl in Android terminal emulator preferences)
(Now hold volume down and press D on your keypad)
“chmod 777 x” (enter)
8. The above procedure makes a script named “x”, whenever you want to start GUI, you need to type “x” (enter).
Notice that the first time (only the first time) you run “x” script you'll be prompt to enter a password for VNC connection, then you'll be asked whether to create a “view-only” password, since it is not necessary, answer “n” to the question.
9. Start “android-vnc-viewer”, create a new connection with the following settings:
Nickname: (anything you like to identify the connection)
Password: the VNC connection password that you created when ran the “x”script
Address: localhost
Port: 5901
Color format: 24-bit color (4 bpp)
Click “Connect” button, and in about a minute, you'll see your Ubuntu 10.10 desktop!
10. We still need to create one final script called “s”, now go back to your Ubuntu terminal and type:
“cd /bin” (enter)
“cat > s” (enter)
“export USER=root” (enter)
“vncserver -kill :1” (enter)
“vncserver -kill :2” (enter)
“sudo reboot” (enter)
“sudo halt” (enter)
(enter)
(press and hold Vol- & click “D” on keyboard)
“chmod 777 s” (enter)
11. If you have GUI running, you * MUST * type “s” (enter) to stop VNC server before you exit from Ubuntu terminal!
In case that your Android kills your Android Terminal application and you still have VNC server running, do the following steps:
a. Start Android Terminal
b. type “bootubuntu” (enter) to bring back Ubuntu terminal
c. type “s” (enter) to stop VNC server
d. type “exit” (enter) to exit from Ubuntu terminal
Fail to do so you will have problem with VNC connection next time you use it.
What's not currently working in Ubuntu:
1. Sound
2. Some applications may not run (I guess, due to Android memory management mechanism)
A little trick to access SD card from your Ubuntu:
1. Install “SwiFTP” from Market (freeware)
2. Set up FTP server using SwiFTP
3. In Ubuntu, “Places → Connect to Server” then:
Service type: FTP (with login)
Server: localhost
Port: (port number specified in SwiFTP, default is 2121)
Folder: /
User Name: (user name specified in SwiFTP)
Then press “Connect” and enter your password specified in SwiFTP. Now feel free to access your phone's file system!
This is a rough guide for the time being, I will hopefully continue work on this in the future (time permitting of course)
ENJOY!!
Thank you Lee!
I'll try this ASAP.
we needed a DHD specific guide written by a reliable and trusted member.
YEAH Lee! THANKS!
Downloading atm, but only one seed, guess its you? But 2.0kb/s and 3 days...hm...
Looking good so far, hoepfully this works, running linux is far better than android!!!
Yeah man this looks pretty cool!
It's cool, but a little fiddly..
Would recommend grabbing virtual tracked from the market, makes it a little easier.. I'm egarly awaiting the new .4 image, ill keep yall posted if I hear anything
P s... please help seed the torrent
Sent from my LeeDrOiD loaded HTC Desire HD
Il be playing with the honeycomb Rom next
Sent from my LeeDrOiD loaded HTC Desire HD
LeeDroid said:
Il be playing with the honeycomb Rom next
Sent from my LeeDrOiD loaded HTC Desire HD
Click to expand...
Click to collapse
That'll be great!! greater than great.
your awesome mate!
Nice. Was just downloading something like this from Demonoid.
LeeDroid said:
Il be playing with the honeycomb Rom next
Sent from my LeeDrOiD loaded HTC Desire HD
Click to expand...
Click to collapse
THAT... would be totally awesome.
awesome lee i really wanted to try this but i dont have 3gb free need to save for a 16gb damn
downloading now will seed as soon as it has
finished downloading now seeding not to fast though 5kb/s
A5J4DX said:
awesome lee i really wanted to try this but i dont have 3gb free need to save for a 16gb damn
Click to expand...
Click to collapse
same here.. bummer.
Yes! Downloading using swarm on my phone now
Hm, weird...everything is fine until i write bootubuntu after i get a wall of text with many errors consisting of "Device or resource busy" for example "mount: mounting /dev/block/loop1 on /data/local/ubuntu failed: device or resource busy"
or
mounting sysfs on /data/local/ubuntu/sys failed: no such file or directory
any ideea?
You have apps installed to the fat 32 partition as per FroYo A2SD.
Go to settings - applications - manage applications - select the sd tab, and move them to internal
Sent from my LeeDrOiD loaded HTC Desire HD
Damn you are right, my bad for not reading everything, was too excited , thanks.
robE9 said:
Damn you are right, my bad for not reading everything, was too excited , thanks.
Click to expand...
Click to collapse
ordered a 16micro sd card today and i see this
now the delivery date seems very far i really want to try ubuntu this is another sucker punch to the iphone user
sounds like fun downloading just now will seed with my seedbox
"exit" wont work. Your file is named "exitu"
one other question...i had ubuntu launched, but then i messed up with the CTRL and so on, tried to "exit" ubuntu, rebootet phone, but now i cant "bootubuntu" gives me the error " cannot create /data/local/ubuntu/etc/resolv.conf: directory nonexistent" and two other directories
After 3 days trying to fix my USB Brick in My Touch 3G HTC Magic, and got nothing, invented this method:
1. We climbed and mtd0.img flash_image files to an FTP server, I have mine on a server that will give them to you, do not use is:
FTP host name: geecko.site90.com
FTP user name: a4977439
FTP user password: freepass01
2. Terminal Emulator and download the install it, reminding him of the Market full suction, I just connect my phone with wifi and enter the market.com (I think it's that xD) and they look and then give up and is sent to your phone, of course if you have your gmail account open in your phone and PC.
3. Download a FTP manager for android, I use the AndFTP, we can do in the same way that we installed in the Terminal Emulator.
4. Open the terminal emulator and enter the following commands
"su" - to have administrator permissions
chmod 777 / data / - to change the permissions to the folder where you downloaded the file data
5. Then we connect to the host via FTP with AndFTP and then configure it by selecting the folder where we asked DATA "folder where you download the files."
6. connect to the server, enter into the public_html directory and select the files mtd0.img and flash_image and unloaded, and we expect the HOME key
7. walked into Terminal Emulator and type chmod 775 / data / to protect the folder and then write data / flash_image misc / data/mtd0.img and reboot.
Sometimes the data / flash_image misc / data/mtd0.img ami fails but gave me errors, just restart and ready and had my memory ready xD
I just hope it does not change the password to the HOST xD
My English no so good
i have a good idea
xD Enjoy!!!!!
Here are a few commands for Android in terminal. If you have any commands that you think should be here, just reply. Enjoy!
chmod - give/take rights away from files. The numbers you see in the how-to's is a little complicated. It has to do with the rights you are assigning the file or folder. http://wiki.linuxquestions.org/wiki/Chmod for further reading.
cat - look at, modify, or combine a file. You can also copy files with this command by "reading" it to another file instead of to the screen.
cd - change from one directory to another
cp - Copy a file from one location to another
dd - copies exact locations to other locations. Can be an entire drive, a folder, etc.
dd if= of=. uses an input file and an output file.
exit - exits the shell you are in. When you type su you start up a shell.
ls - lists all files with in a directory try ls - l too.
mv - Move a file from one location to another. At the same time you can rename a file.
su - Substitute User. We type this to switch to the root user. You need to type this command first to do a lot of the other commands.
tar - creates taped archives. Compresses files like winzip, 7zip, winrar and others tar /? for details.
rm - followed by a file name with delete the file sync - synchronizes any data on disk with data in memory. We type this before rebooting to ensure we've got all data written
Other commands of interest:
df - how much free disk space. In linux you can add a switch "df -h" but the "-h" does nothing for me on Android. top - like task manager, it displays running processes. in Linux the q key quits. On Android I don't know how to make it quit other than closing the app. uptime - displays how long it has been since you last rebooted the system.
busybox - a tool that combines many linux commands into a single compact file. Typing this displays all the commands at your disposal.
busybox df - a much easier to read display of free diskspace. This display shows how full (use%) each file system is.
Thanks
thank you so much, well for a noob like me very informative was looking for this kind from very long :laugh:
Substitute user XD you know it is superuser right?
free - see all free Memory from the Device
mid-kid said:
Substitute user XD you know it is superuser right?
Click to expand...
Click to collapse
Actually substitute user is also correct.
"The su command, also referred to as substitute user, super user, or switch user, allows a computer operator to change the current user account associated with the running virtual console."
Source: http://en.wikipedia.org/wiki/Su_(Unix)
Sent from my Galaxy Nexus using xda premium
So practically the basic linux comands are the same with android terminal!!!
I just noticed that the ping command is working just fine
Type ping 4.2.2.4 for example
rezo609 said:
If you have any commands that you think should be here, just reply. Enjoy!
Click to expand...
Click to collapse
svc data enable - turn on mobile data
svc data disable - turn off mobile data
svc wifi enable - turn on wifi
svc wifi disable - turn off wifi
svc help - show information about subcommands
For the top command mentioned in the OP, just type "top -n 1" and it will exit, leaving you with the readout at the time you executed the command. -n is for number of updates before stopping.
Also will add that the powertop command will show the top reasons for wakeups from idle.
Tnx
Metalcorpe said:
So practically the basic linux comands are the same with android terminal!!!
Click to expand...
Click to collapse
Yep
rezo609 said:
If you have any commands that you think should be here, just reply.
Click to expand...
Click to collapse
grep - Useful to apply filters to other commands. For example, to list only the apk files inside a folder:
Code:
ls /folder/to/list | grep apk
or to search a string inside a file:
Code:
cat /file | grep stringToSearch
logcat - Debugging tool, all the system messages are shown here. To show only the debug messages (useful when an app is giving FC without apparent reason), type:
Code:
su
logcat -d
mount - The most common use for this command is remount the system partition, to modify its content (be careful, you can easily brick your device!). Common usage (needs root):
Code:
Mount /system in Read/Write mode:
mount -o rw,remount /system
Mount /system in Read Only mode:
mount -o ro,remount /system
Saving command output to file. Type
Code:
command >> /folder/to/save/file
If the file doesn't exist will be created, otherwise, the info will be added to the end of the file.
You can also use:
Code:
command > /folder/to/save/file
If the file doesn't exist also will be created, but if the file exists its content will be deleted before add the info.
mount - Mounting a partition
umount - Unmounting a mounted partition
reboot - Reboot phone
stop - Shutdowns the GUI
start - Restarts GUI
above two commands can be used to get a fast reboot.
Also you my use the reboot command to do a faster restart to the device but your are going to lose any unsaved work
You must be rooted
First type : su
Then : reboot
Sent from my GT-I9505 using XDA Premium 4 mobile app
run program with command
I want to run "Applock"s lock all command. I have widgetsoid which can create shortcut for any command. How to do it? I am rooted.
SAVED ME!
toasterwater said:
svc data enable - turn on mobile data
svc data disable - turn off mobile data
svc wifi enable - turn on wifi
svc wifi disable - turn off wifi
svc help - show information about subcommands
Click to expand...
Click to collapse
Dude, thank you so much for posting this information. I had switched my MNVO service to a newer a phone, and this one was just sitting around. There were still things on it that I needed like some notes that I had saved. Because I had not used it in a while, and there was no data/cell service on it, I was out of luck (or so I thought) when I forgot my unlock pin. It wouldn't accept my google login information because there was no data connection. I COULD NOT GET INTO MY PHONE! I was dreading the possibility of having to factory reset, which would erase my notes and other things saved on there. On a whim and after MUCH Google searching, I was trying to find a way to reset the number of attempted pin locks to no avail. I was about to give up, but luckily, I remembered I had rooted it. And after downloading the latest SDK bundle, I came across your post. It allowed me to turn the wifi on my cell phone even though I was "locked out." Wouldn't you know that it very quickly picked up my home wifi signal. Because a data connection was enabled, I was then able to use my gmail login information to get into the phone. Your post saved me and prevented me from having to factory reset my phone and losing my information. Thank you so much!
netstat - show connections status in local device
...
rezo609 said:
Here are a few commands for Android in terminal. If you have any commands that you think should be here, just reply. Enjoy!
chmod - give/take rights away from files. The numbers you see in the how-to's is a little complicated. It has to do with the rights you are assigning the file or folder. http://wiki.linuxquestions.org/wiki/Chmod for further reading.
cat - look at, modify, or combine a file. You can also copy files with this command by "reading" it to another file instead of to the screen.
cd - change from one directory to another
cp - Copy a file from one location to another
dd - copies exact locations to other locations. Can be an entire drive, a folder, etc.
dd if= of=. uses an input file and an output file.
exit - exits the shell you are in. When you type su you start up a shell.
ls - lists all files with in a directory try ls - l too.
mv - Move a file from one location to another. At the same time you can rename a file.
su - Substitute User. We type this to switch to the root user. You need to type this command first to do a lot of the other commands.
tar - creates taped archives. Compresses files like winzip, 7zip, winrar and others tar /? for details.
rm - followed by a file name with delete the file sync - synchronizes any data on disk with data in memory. We type this before rebooting to ensure we've got all data written
Other commands of interest:
df - how much free disk space. In linux you can add a switch "df -h" but the "-h" does nothing for me on Android. top - like task manager, it displays running processes. in Linux the q key quits. On Android I don't know how to make it quit other than closing the app. uptime - displays how long it has been since you last rebooted the system.
busybox - a tool that combines many linux commands into a single compact file. Typing this displays all the commands at your disposal.
busybox df - a much easier to read display of free diskspace. This display shows how full (use%) each file system is.
Click to expand...
Click to collapse
if i wanted to delete a directory with data ? what would be the syntax
Set/View Network Host Name
Run the following as root
setprop net.hostname <new_hostname> // To Change Device Hostname
getprop net.hostname // To View Device Hostname
list of all android terminal commands
Open terminal or file explorer with root access
From root folder go to /system/bin
Type command :ls
The list contains all the terminal codes available
Enjoy!!
Disclaimer1: I'm not responsible if anything goes wrong while you try out the codes.
Disclaimer:man & help pages are not available on android terminal
HI,
I would like to share the way how I mounted my NAS folders with SSHFS based on Debian KIT.
SSH-FS is ssh based mountable file system. If you have SSH account you can mount and access that server like a windows share.
Forewords:
Debian KIT is free! and it is _NOT_ yet another chroot debian!
This method is an alternative and FREE way to have SSHFS vs to the unique native Android SSHFS app (which is unfortunately paid. )
It is fully integrated with Androitd! Less ram resources and faster than chroot. Debian libraries are binded to Android.
So you enjoy Android and Debian advantages all together.
Steps to have SSHFS:
Set up Debian on your Android! Go to Debian Kit page and set up Debian!
Run Debian. Open Terminal Emulator and type
Code:
$deb
$sudo su
Set up SSHFS
Code:
#apt-get update
#apt-get install sshfs
Mount SSHFS
Code:
#mkdir /mnt/nas
#sshfs [email protected]:/ /mnt/nas/ -o allow_other
Checking mount:
Code:
#mount
[email protected]:/ on /mnt/nas type fuse.sshfs (rw,nosuid,nodev,relatime,user_id=0,group_id=0,allow_other,max_read=65536)
Then SSHFS will ask your root password and that all!
If no error then its ok, You Mounted!!
You done! :laugh:
Go back to Android and use your mounted share with any Android file manager under /mnt/nas (or where ever you mounted.)
Finishing all, just
Code:
#deb u
(It will umount and close debian session.)
For more comfort, set up password-less login to ssh server with authorized_keys.
#ssh-keygen
#cat ~/.ssh/id_rsa.pub >> /mnt/nas/root/.ssh/authorized_keys
#chmod 600 /mnt/nas/root/.ssh/authorized_keys
After above steps your ssh server wont ask root password from this site to that site logging in with root user.
Press "Thanks" button if its helps for you.
Regards
Robert
Convert docs to pdf with Openoffice within Debian Kit
Another great usage example of Debian kit:
Use your installed Open/Libre/Star/Office to convert your document to pdf:
#!/bin/bash
time soffice --headless --convert-to pdf $1
exit
Check your doc converted to pdf after a minute.
Thanks for the awesome guide. Any idea about mounting virtual drives from my Ubuntu?
whu007 said:
Thanks for the awesome guide. Any idea about mounting virtual drives from my Ubuntu?
Click to expand...
Click to collapse
Hi,
thanks.
>mounting virtual drive...
Can you please describe a little, what is the scenario?
Regards Robert
SSHFS problems @ Android 4.2.2 Nexus 10 - apps cannot see mounted content
Hi,
Robert, thanks for the guide to sshfs with debian-kit. I've been longing to get sshfs on my Android for three years
My problem is that Android Apps cannot see the mounted content, which is what I desire.
I have managed to get debian-kit + sshfs installed, and my nas mounted using sshfs. I can browse the files on the nas from the mounted directory in the ConnectBot Shell, but I cannot see the mounted directory through android apps (or adb shell), eg TotalCommander, OI FileManager, MX video player. I have tried the TotalCommander Android app, and tried telling TotalCommander to always use root (in case user made a difference).
I mounted the nas using ConnectBot local shell with the command:
> sshfs [email protected]:/mnt/user/ /mnt/tower/ -o allow_other
I can see the /mnt/tower content both with the ConnectBot shell as normal user ([email protected]), as root, and with the shell I get after running 'deb' from a ConnectBot shell.
If I remote login from PC to an SSHDroid server on the Android, then I cannot see the mounted content of /mnt/tower (even as root). Neither can Android apps. If I install the openssh-server in debian and stop the SSHDroid server, then I can see the /mnt/tower content from my ssh login from PC.
Best Alex
I've an issue, after mounting the nas folder I try to add it into the Poweramp library, it recognizes it (I've mounted into /sdcard/nas) but none of the mp3 is added to library
thank you
Thanks for the great guide!
Now how can you unmount the SSHFS directory?
The normal way is with:
Code:
fusermount -u /mnt/share
However this causes an error:
Code:
fusermount: failed to bind parent to /: Invalid argument
Does that happen for everyone or is it just me?
Restarting the Debian system with
Code:
deb -u
also did not cause the SSHFS directory to unmount.
Sent from my Nexus 4 using xda app-developers app
Hi
Just try umount /mnt/mountpoint.
Robert
Sent from my GT-N8013 using xda app-developers app
Thank you for this guide! Unfortunately this solution isn't quite what I'm looking for. I found that in order to get my apps to recognize the mounted share I have to first run the app, then mount the share. Also, if the app gets killed I have to unmount the share and then remount it in order for the share to become visible again from within the android app. However, the share remains mounted when viewed from within the debian shell or adb.
Anyone have an idea why this might be happening?
Debian kit not working on S4
Hey, there. I have a rooted Samsung Galaxy S4 (VZW) running stock.
I get this error after all MD5 sums pass:
ash: id: Permission denied
Can someone please assist me or point me in the right direction?
aikeru said:
Hey, there. I have a rooted Samsung Galaxy S4 (VZW) running stock.
I get this error after all MD5 sums pass:
ash: id: Permission denied
Can someone please assist me or point me in the right direction?
Click to expand...
Click to collapse
did you get this right after you started installing? after you used the 'sh' command?
Sounds to me like you might not have root in android, or you didn't click the accept button when the app asked for root permissions.
---------- Post added at 10:46 AM ---------- Previous post was at 10:44 AM ----------
m2xtreme said:
Thank you for this guide! Unfortunately this solution isn't quite what I'm looking for. I found that in order to get my apps to recognize the mounted share I have to first run the app, then mount the share. Also, if the app gets killed I have to unmount the share and then remount it in order for the share to become visible again from within the android app. However, the share remains mounted when viewed from within the debian shell or adb.
Anyone have an idea why this might be happening?
Click to expand...
Click to collapse
I don't think there is much you can do to get around always having to have deb environment open. One way you might be able to kill a few steps is use the 'autofs' package in debian to automatically mount the sshfs share when you login to the debian envorinment.
I haven't tried autofs yet, but it's on my todo list, i'll report back with my findings.
---------- Post added at 11:19 AM ---------- Previous post was at 10:46 AM ----------
chrisonline1991 said:
I haven't tried autofs yet, but it's on my todo list, i'll report back with my findings.
Click to expand...
Click to collapse
So i had some problems running autofs and i can't seem to find the problem, maybe someone more knowledgeable can help. When i install autofs the output is below, but it looks like it did install fine.
Code:
Starting automount: Error: failed to load autofs4 module.
invoke-rc.d: initscript autofs, action "start" failed.
dpkg: error processing autofs5 (--configure):
subprocess installed post-installation script returned error exit status 1
configured to not write apport reports
Errors were encountered while processing:
nfs-common
autofs5
E: Sub-process /usr/bin/dpkg returned an error code (1)
When i run
Code:
$ sudo dpkg --configure -a
it returns
Code:
Setting up nfs-common (1:1.2.2-4squeeze2) ...
insserv: warning: script '99CleanTWEAKS' missing LSB tags and overrides
Starting NFS common utilities: statd failed!
invoke-rc.d: initscript nfs-common, action "start" failed.
dpkg: error processing nfs-common (--configure):
subprocess installed post-installation script returned error exit status 1
Setting up autofs5 (5.0.4-3.2) ...
insserv: warning: script '99CleanTWEAKS' missing LSB tags and overrides
Starting automount: Error: failed to load autofs4 module.
invoke-rc.d: initscript autofs, action "start" failed.
dpkg: error processing autofs5 (--configure):
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
nfs-common
autofs5
I found this bug report which points to this bug report that says something about the newest autofs using a new upstart feature called 'wait-for-state' and something is going wrong with it. Looks like they added the bugfix to Ubuntu Precise. And looks like that fix might now have solved the problem as another bug was opened, but i'm not sure if it's related to this. I'm a little burnt out on this at the moment.
Hope this helps someone. If anyone else has some suggestions let me know and i'll try them out.
Hi
I have been trying to get something like this working for awhile...
Any chance by using debian kit this can automatically run at startup and mount my PC to my Android device?
my android apps just see an empty dir. In my terminal the sshfs command works as expected. When I cd into the mounted directory I can see its contents, android apps just see an empty dir.
Has any one managed to solve this?
late-2017 update
bisbal said:
my android apps just see an empty dir. In my terminal the sshfs command works as expected. When I cd into the mounted directory I can see its contents, android apps just see an empty dir.
Has any one managed to solve this?
Click to expand...
Click to collapse
I ran into a thread on stack exchange that says to mount the sshfs-accessed shares to subdirectories of /data/media/0/. I've yet to try it myself, but it sounds plausible.
(https://android.stackexchange[dot]com/questions/50246/mount-inside-subdir-of-storage-emulated-0)
I was initially reluctant to raise an old topic, but I think this is important; being able to mount a remote data store to your local filesystem is crucial to the mobile environment as the tendency of well-known phone companies like Samsung and Apple in removing the external sd card feature (even my OnePlus 3 doesn't have it). I did consider the Nextbit Robin as my next phone for the smart data storage design, but opted out because of the aging hardware.