# SSH client problems



## gdanko (Jun 25, 2011)

When I run ssh from the command line I get these options:

localhost / # ssh
ssh
Dropbear client v0.53.1
Usage: ssh [options] [[email protected]]host[/port][,[[email protected]]host/port],...] [command]
Options are:
-p <remoteport>
-l <username>
-t Allocate a pty
-T Don't allocate a pty
-N Don't run a remote command
-f Run in background after auth
-y Always accept remote host key if unknown
-s Request a subsystem (use for sftp)
-i <identityfile> (multiple allowed)
-A Enable agent auth forwarding
-L <[listenaddress:]listenport:remotehost:remoteport> Local port forwarding
-g Allow remote hosts to connect to forwarded ports
-R <[listenaddress:]listenport:remotehost:remoteport> Remote port forwarding
-W <receive_window_buffer> (default 24576, larger may be faster, max 1MB)
-K <keepalive> (0 is never, default 0)
-I <idle_timeout> (0 is never, default 0)
-B <endhost:endport> Netcat-alike forwarding
-J <proxy_program> Use program pipe rather than TCP connection
-v verbose (compiled with DEBUG_TRACE)

The command to execute an SSH tunnel is:
ssh -fN [email protected] -L 2222:linux.test.com:22

But on my phone the output is:

localhost / # ssh -fN [email protected] -L 2222:linux.test.com:22
ssh -fN [email protected] -L 2222:linux.test.com:22
ssh: Exited: Command required for -f

Since when is a command required for -f?


----------



## gdanko (Jun 25, 2011)

Solved:
ssh -f -N [email protected] -L 2222:linux.test.com:22


----------



## poontab (Jun 7, 2011)

Moved to general. Please use development sections for releases only.


----------



## gdanko (Jun 25, 2011)

Next problem:

localhost / # ssh -f -N [email protected] -L 2222:linux.test.com:22
ssh: Warning: failed creating //.ssh: Read-only file system

Host 'proxy.test.com' is not in the trusted hosts file.
(fingerprint md5 e4:51:30:dc:c5:9a:fc:51:29:36:18:4d:4e:30:bd:67)
Do you want to continue connecting? (y/n)

Maybe I need to rebuild Dropbear SSH to use another directory for .ssh? Maybe put it in /data/.ssh ?


----------



## yarly (Jun 22, 2011)

gdanko said:


> Next problem:
> 
> localhost / # ssh -f -N [email protected] -L 2222:linux.test.com:22
> ssh: Warning: failed creating //.ssh: Read-only file system
> ...


 You would need to put it somewhere and give it permissions to read/write (since it's a command line only app, I'm not sure where short of mounting your drive [maybe /data/local/tmp] or putting on your sdcard. ".ssh" is just the directory your keys are normally stored if you're using ssh key login instead of passwords [much safer than using passwords]).

However, it still looks like it's connecting regardless of that.


----------



## gdanko (Jun 25, 2011)

I built zlib for ARM then built Dropbear against the ARM zlib and the compile succeeded but I get a weird error when trying to execute the binary. Mind you, I've built a few things for Android and this is the first time I've seen this error...

* Verify the binary on my Linux box:

[[email protected] bin]$ ls -l
total 352
-rwxr-xr-x 1 root root 197553 Oct 3 07:26 dbclient
-rwxr-xr-x 1 root root 75206 Oct 3 07:26 dropbearconvert
-rwxr-xr-x 1 root root 77992 Oct 3 07:26 dropbearkey
[[email protected] bin]$ file *
dbclient: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.16, not stripped
dropbearconvert: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.16, not stripped
dropbearkey: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.16, not stripped

asb push them to the sdcard then copy the whole directory to /system:

[[email protected] android]$ adb push dropbear /mnt/sdcard/
push: dropbear/bin/dropbearconvert -> /mnt/sdcard/bin/dropbearconvert
push: dropbear/bin/dropbearkey -> /mnt/sdcard/bin/dropbearkey
push: dropbear/bin/dbclient -> /mnt/sdcard/bin/dbclient
push: dropbear/sbin/dropbear -> /mnt/sdcard/sbin/dropbear
4 files pushed. 0 files skipped.
1191 KB/s (556088 bytes in 0.455s)

localhost sdcard # cd /system/
localhost system # mv /mnt/sdcard/dropbear .

Set owner and perms:

localhost bin # pwd 
/system/dropbear/bin
localhost bin # chown 0:0 *
localhost bin # chmod 0755 *
localhost bin # ls -l
-rwxr-xr-x 1 root root 197553 Oct 3 07:26 dbclient
-rwxr-xr-x 1 root root 75206 Oct 3 07:26 dropbearconvert
-rwxr-xr-x 1 root root 77992 Oct 3 07:26 dropbearkey

Execute dbclient:

localhost bin # ./dbclient 
bash: ./dbclient: No such file or directory


----------



## gdanko (Jun 25, 2011)

Oooh I think the problem is that the binary is statically linked. It's still dynamic even though I specified static. Grrrr.


----------



## yarly (Jun 22, 2011)

Yep, probably missing libraries. At worse, compile it with something other than NDK, that might help.


----------

