# SSH directory



## lnk2past (Aug 3, 2012)

So I recently began to look into SSH and how I can use it to remotely access my phone from a computer, and my home computer remotely from my phone. I have everything set up just fine, but I am having a few issues.

The Setup:
Windows 7 Ultimate x64
cygwin sshd server

Droid 4 - rooted
Android Version: 2.3.6
ConnectBot
SSHDroid

Primary Issue:
I use ConnectBot to SSH into my computer via the cygwin server. I can browse my desktop files just fine. I can also SSH into my phone from my desktop via SSHDroid and do the same. 

I wanted to test retrieving a file from my desktop on my phone. So, I SSH into my desktop, and browsed to cygdrive/c. I placed a picture titled "Rapture.jpg" to my c:/ for the test. On my phone, in cygwin, I ran the following:

scp -P 22 [email protected]:/cygdrive/c/Rapture.jpg /root

It prompted me for my password, and I enter. It then outputs "100% 1676kB 1.6MB/s 00:00" , but there is no file to be found. I noticed that if I just entered:

scp -P 22 [email protected]:/cygdrive/c/Rapture.jpg picture.jpg

it would place a new picture.jpg in my own C:/. How can I direct this to place the file in my root directory on my phone?

Another, but less important, problem that I am having is shelling into my phone when the phone is not on my home network. SSHDroid tells me the IP to log into, but the connection always times out. If I go to whatsmyip.com on my phones browser, the IP listed there is different than the one listed in SSHDroid. Any help with this problem would be appreciated as well.


----------



## lnk2past (Aug 3, 2012)

Upon further investigating, it looks like for Windows systems, I need to do this sort of thing through winSCP... but when I try to go through that, it just hangs at "Starting session" until I abort. Here is the log generated:


. 2012-08-04 14:50:18.588 --------------------------------------------------------------------------
. 2012-08-04 14:50:18.588 WinSCP Version 4.3.9 (Build 1817) (OS 6.1.7601 Service Pack 1)
. 2012-08-04 14:50:18.588 Configuration: HKEY_CURRENT_USER\Software\Martin Prikryl\WinSCP 2\
. 2012-08-04 14:50:18.588 Local account: Nick-PC\Nick
. 2012-08-04 14:50:18.588 Login time: Saturday, August 04, 2012 2:50:18 PM
. 2012-08-04 14:50:18.588 --------------------------------------------------------------------------
. 2012-08-04 14:50:18.588 Session name: DROID (Stored session)
. 2012-08-04 14:50:18.588 Host name: 192.168.1.8 (Port: 1189)
. 2012-08-04 14:50:18.588 User name: root (Password: No, Key file: No)
. 2012-08-04 14:50:18.589 Tunnel: No
. 2012-08-04 14:50:18.589 Transfer Protocol: SFTP (SCP)
. 2012-08-04 14:50:18.589 Ping type: -, Ping interval: 30 sec; Timeout: 15 sec
. 2012-08-04 14:50:18.589 Proxy: none
. 2012-08-04 14:50:18.589 SSH protocol version: 2; Compression: No
. 2012-08-04 14:50:18.589 Bypass authentication: No
. 2012-08-04 14:50:18.589 Try agent: Yes; Agent forwarding: No; TIS/CryptoCard: No; KI: Yes; GSSAPI: No
. 2012-08-04 14:50:18.589 Ciphers: aes,blowfish,3des,WARN,arcfour,des; Ssh2DES: No
. 2012-08-04 14:50:18.589 SSH Bugs: A,A,A,A,A,A,A,A,A
. 2012-08-04 14:50:18.589 SFTP Bugs: A,A
. 2012-08-04 14:50:18.589 Return code variable: Autodetect; Lookup user groups: Yes
. 2012-08-04 14:50:18.589 Shell: default
. 2012-08-04 14:50:18.589 EOL: 0, UTF: 2
. 2012-08-04 14:50:18.589 Clear aliases: Yes, Unset nat.vars: Yes, Resolve symlinks: Yes
. 2012-08-04 14:50:18.589 LS: ls -la, Ign LS warn: Yes, Scp1 Comp: No
. 2012-08-04 14:50:18.589 Local directory: default, Remote directory: home, Update: No, Cache: Yes
. 2012-08-04 14:50:18.589 Cache directory changes: Yes, Permanent: Yes
. 2012-08-04 14:50:18.589 DST mode: 1
. 2012-08-04 14:50:18.589 --------------------------------------------------------------------------
. 2012-08-04 14:50:18.672 Looking up host "192.168.1.8"
. 2012-08-04 14:50:18.672 Connecting to 192.168.1.8 port 1189
. 2012-08-04 14:50:18.694 Server version: SSH-2.0-dropbear_0.53.1
. 2012-08-04 14:50:18.694 Using SSH protocol version 2
. 2012-08-04 14:50:18.694 We claim version: SSH-2.0-WinSCP_release_4.3.9
. 2012-08-04 14:50:18.701 Using Diffie-Hellman with standard group "group14"
. 2012-08-04 14:50:18.701 Doing Diffie-Hellman key exchange with hash SHA-1
. 2012-08-04 14:50:19.713 Host key fingerprint is:
. 2012-08-04 14:50:19.713 ssh-rsa 1039 c0:a6:4e:6d:55:b5:0e:39:ec:14:73:c9:8d:0a:9e:b2
. 2012-08-04 14:50:19.713 Initialised AES-256 SDCTR client->server encryption
. 2012-08-04 14:50:19.713 Initialised HMAC-SHA1 client->server MAC algorithm
. 2012-08-04 14:50:19.713 Initialised AES-256 SDCTR server->client encryption
. 2012-08-04 14:50:19.713 Initialised HMAC-SHA1 server->client MAC algorithm
. 2012-08-04 14:50:19.719 Pageant is running. Requesting keys.
. 2012-08-04 14:50:19.719 Pageant has 0 SSH-2 keys
! 2012-08-04 14:50:19.719 Using username "root".
. 2012-08-04 14:50:21.221 Prompt (7, SSH password, , &Password: )
. 2012-08-04 14:50:23.100 Sent password
. 2012-08-04 14:50:23.151 Access granted
. 2012-08-04 14:50:23.155 Opened channel for session
. 2012-08-04 14:50:23.185 Started a shell/command
. 2012-08-04 14:50:23.187 --------------------------------------------------------------------------
. 2012-08-04 14:50:23.187 Using SFTP protocol.
. 2012-08-04 14:50:23.187 Doing startup conversation with host.
> 2012-08-04 14:50:23.189 Type: SSH_FXP_INIT, Size: 5, Number: -1
. 2012-08-04 14:50:38.189 Waiting for data timed out, asking user what to do.
. 2012-08-04 14:50:38.189 Asking user:
. 2012-08-04 14:50:38.189 Host is not communicating for 15 seconds.
. 2012-08-04 14:50:38.189 
. 2012-08-04 14:50:38.189 Wait for another 15 seconds? ()
. 2012-08-04 14:50:39.345 Attempt to close connection due to fatal exception:
* 2012-08-04 14:50:39.345 Terminated by user.
. 2012-08-04 14:50:39.345 Closing connection.
. 2012-08-04 14:50:39.345 Sending special code: 12
. 2012-08-04 14:50:39.345 Sent EOF message
* 2012-08-04 14:50:39.353 (ESshFatal) Terminated by user.
* 2012-08-04 14:50:39.353 Cannot initialize SFTP protocol. Is the host running a SFTP server?


----------



## lnk2past (Aug 3, 2012)

So I do not mean to post again, but this same sort of hanging happens if I try perform a file transfer with putty pscp from my desktop. This hanging also happens when I try to properly initiate a file transfer from my phone via SSH into my desktop cygwin.


----------

