[erlang-bugs] Bugs in SSH

Charles Ahn <>
Mon Nov 10 12:51:47 CET 2008


Hello,

The ssh daemon will not function correctly (logging in fails) with  
only ssh_host_rsa_key and ssh_host_rsa_key.pub in system_dir. However,  
ssh_host_dsa_key and ssh_host_dsa_key.pub are sufficient by themselves  
for the ssh daemon to function correctly. This means that the ssh  
daemon does start if both keys exist but there seems to be no way to  
force the daemon to use the RSA keys.

Also, I have some code using the daemon in which two users connecting  
to the server (different logins), cause the server to close all open  
connections. (Ie, logging in as admin and root, and having admin type  
quit will close both connections). I wouldn't be surprised if this is  
because I am doing something wrong though:
-module(ssh_example).
-export([start/0, dispatch/0, dispatch_init/0, recv_loop/1]).

-include("ssh_example.hrl").

start() ->
   crypto:start(),
   ssh:start(),
   ssh:daemon({0,0,0,0}, 1122, [{shell, {?MODULE, dispatch, []}},
       {user_passwords, [{"admin", "admin"}, {"root", "admin"}]},  
{system_dir, "/erlang_test"}]).

dispatch() ->
   spawn(?MODULE, dispatch_init, []).

dispatch_init() ->
   io:format("Hello user!\n"),
   Rec = spawn_link(?MODULE, recv_loop, [self()]),
   loop(Rec).

loop(Rec) ->
   receive
     {Rec, Line} ->
       io:format("~s~s",[?FG_GREEN, Line])
   end,
   case Line of
     "quit\n" ->
       io:format("Good bye!\n"),
       exit(Rec, ok);
     _ ->
       loop(Rec)
   end.

recv_loop(Dispatcher) ->
   Prompt = "> ",
   Line = io:get_line(?RESET ++ Prompt),
   Dispatcher ! {self(), Line},
   ?MODULE:recv_loop(Dispatcher).


Charles



-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2419 bytes
Desc: not available
URL: <http://erlang.org/pipermail/erlang-bugs/attachments/20081110/530f5707/attachment.bin>


More information about the erlang-bugs mailing list