[General Topics] notquiteageek:
As a new Android user but experienced in Linux I wanted to explore the command shell. I've wanted to change passwords and have use the usual commands I would normally expect to be available.

I'd like to share my experience for any other new user and open the discussion for for additions and corrections. What I say here works on a Galaxy Mini S5570 but should be pretty generic. This really does need the phone to be rooted or much will be inaccessible.

Comparing 3 methods Terminal Emulator, DigiSSHD which is run from DigiControl and SSHDroid.

There is no concept of a root password as access is granted via superuser app. When you connect your id is set from the id of the app you are using to connect.

The simplest connection is via Terminal Emulator. It requires no network connection and gives direct access to the phone. The first thing is that you have no home directory so you are dumped into / the top directory. There is no .bash_profile, .bashrc or .profile so it's customisation is not obvious.

I tested SSHDroid and DigiSSHD using wi-fi. My ssh client was the excellent Putty on Windows7.

As default SSHDroid uses port 22 while DigiSSHD uses port 2222.

For a rooted phone SSHDroid has user "root" with password "admin". This is not your device's root password. You can think of it as an access password for SSHDroid. This access password can be changed in the options for SSHDroid. It is a good idea to do so stop others getting in just as you have done.

You arrive in a home directory data/data/berserker.android.apps.sshdroid/home and inside there you will find a .profile file so you can do some customisations there. The good news is that all the usual linux functions are available in ~/bin via the PATH variable it gives you and its own busybox.

Neither Terminal Emulator nor DigiSSHD give you these functions but this is a good way to do it.

Terminal Emulator by default gives you a PATH which includes /data/local/bin. This is set by Initial Command in the Preferences but I'm taking it as it is.

There was no directory /data/local/bin. This is good because we can create it and put our own stuff in there wihout having inconsistent clashes. Create it with the correct permissions. Copy the permissions of another directory in the path in my case I used /system/bin. To check the permissions:

cd /system

ls -l

The permissions were for bin are drwxr-xr-x with Owner/Group of root and Shell. So create the new directory.

cd /data/local

mkdir bin

chmod 755 bin

chown root.Shell bin

Now you can start creating your utilities. Before you do check that each is not already available by trying to run it. It might already be provided by Toolbox. To see what busybox can do type

busybox --help

To get your utility, assuming it is available in busybox create a symlink to busybox with the name of the utility. As an example this is how to create 'more' and 'less' and the standard 'vi'

cd /data/local/bin

ln -s /system/xbin/busybox more

ln -s /system/xbin/busybox/less

ln -s /system/xbin/busybox/vi

You can carry on activating your favourite utilities. Remember to check if it already there first and NEVER forget you are doing all this as root so take care...

Why do it this way and not use the functions provided by SSHDroid? Well as an ordinary user you may not have access and if you decide to uninstall SSHDroid you would probably lose it.

Now for DigiSSHD. The default user is android with a password of 123. I have not found how to change this yet so comments welcome. Your home directory will be something like /mnt/sdcard/Android/data/org.digimead.digi.ctrl/files/var/1d7a337e-7cf8-4b28-8039-baa894f7185f

There is a .profile file in your home directory that you can edit and add the line

export PATH=/data/local/bin:$PATH

This will give you access to the same utilities (so same versions) as you have with Terminal Emulator.

That's it. The rest is up to you. Which utilities you chose and which command line app suits you. I doubt that all the busybox functions will work on an Android system because it is not an ordinary Linux.

Which is better, SSHDroid or DigiSSHD? I don't know. I'll leave that for others to comment.