February 9, 2011

Windows CE ssh server and client

Windows CE development is not as fun as Linux because of the lack of open source tools. However, once I am able to make ssh server and client running on it, it becomes better. Here is how to get ssh server and client running on windows CE 5 (ARM based):

1. Download CESSH at http://www.codeplex.com/wikipage?projectname=CESSH
    Download sshd_config at http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=CESSH&DownloadId=3561
    Download file http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=CESSH&DownloadId=3562

2. copy the files to your windows CE device, suppose "\ssh"
3. mkdir "\Hard Disk"
4. copy sshd_config "\Hard Disk"
5. mkdir "\NandFlash"
6. mkdir "\NandFlash\ssh"
7. copy ssh_host_dsa_key to "\NandFlash\ssh"
8.  run "adduser.exe root rootpass" to add the user "root" with password "rootpass"
9. copy SocketToFile.DLL to \windows
10. run "sshd.exe" 

To test it, get pocketputty
 (http://www.pocketputty.net/download.html)


If make this work over ActiveSync, use the remote port tunnel in putty.

Another great tool to have is netcat for CE: http://www.dr-bischoff.de/wince/Andreas_WINCE_stuff.html#netcat

Hope this helps.

14 comments:

  1. I've followed the instructions but on this CE device after running sshd, I get:
    Debug2: filename /hard disk/ssh_config: errno=3
    (Note - forward slashes for win?)
    Can you suggest what may be required to get it working please?

    ReplyDelete
  2. Follow the instructions exactly (down to the folder name).

    The problem I have is that I start the server and connect to it, but it closes the connection about 1 second after connecting. I have no idea why.

    ReplyDelete
    Replies
    1. I have the same problem: server closes connection after establish connection and authorizing by public key or by password. Did somebody have a solution?

      Delete
    2. Same Issue
      OP please respond

      Delete
  3. I do not have access to the winCE environment anymore and so I cannot really help out here.

    ReplyDelete
  4. If I only use dsa, ssh is looking for another rsa key. Then I generate a rsa1 key so ssh accepts it, but dsa does not match. Then I generate a dsa key with "ssh-keygen -t dsa" but ssh does not accept that with a "no rsa1 key file" message.
    When I generate a Version 2 rsa and dsa the ssh does not accept them also with "no rsa1 key file" an exits.
    When I generate two rsa1-key files with "ssh-keygen -t rsa1" and use them, it seems ok, but when I will connect, it crashes with "no hostkey alg". Also it says "Disabling protocol version 2: could not load host key" and then "sshd.exe: since only protocol 2 is supported, this is fatal. -- exiting" (but it does not exit. it waits now for connection and crashes if any comes in). When I add a rsa-v2 file and append a new line like "Hostkey rsa_v2_key" in sshd_config it crashes again with "no rsa1 key file", after it loads the two rsa1-key correctly.
    I can't find any solution at the internet, that solve the problem.
    Whats the reasen for? please help.

    ReplyDelete
  5. Alternatives for ssh on Windows CE? I've been stuck since Posting "OP please respond"

    I'm on CE 7.0, I feel like this project might have only ever worked for 5.0

    ReplyDelete
  6. ... I have CE 5.0 and it does not. :(

    ReplyDelete
  7. It seems like the program ignore the "Protocol 2" in sshd_config, isn't it?

    ReplyDelete
  8. I followed this steps, but the SSH connection closes itself immediately after entering the password. Anyone facing the same issue?

    ReplyDelete
  9. I'm lucky to get it all running. Except a simple thing. When I complete "adduser.exe root rootpass" to add the user "root" with password "rootpass" nothing happens. Neither error messages nor a file.

    ReplyDelete
    Replies
    1. Please how do you solve this problem: SSH connection closes itself immediately after entering the password.

      Delete
  10. SSH connection closes itself immediately after entering the password. How can you solve this problem?

    ReplyDelete
  11. Anyone solved the "SSH connection closes itself immediately after entering the password" problem.
    Thanks

    ReplyDelete