[erlang-questions] Replacing default shell in sshd

David Svanlund <>
Sat Nov 8 11:19:57 CET 2008


Charles,

I experimented with the ssh module a couple of days ago. The  
(incomplete) example code below might help you understand how to  
replace the default shell.

-module(ssh_example).
-export([start/0, dispatch/0, hello/0]).

start() ->
   ssh:daemon({0,0,0,0}, 1122, [{shell, {?MODULE, dispatch, []}},  
{user_passwords, [{"davidsvanlund", "banana"}]}]).

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

hello() ->
   io:format("Hello user!\n"),
   loop().

loop() ->
   Line = io:get_line("> "),
   io:format(Line),
   loop().


David


8 nov 2008 kl. 05.39 skrev Charles Ahn:

> I was looking at the ssh module because I was somewhat interested in  
> making a MUD in erlang that people can ssh into, but I can't quite  
> figure out how I should go about doing this.
>
> It appears that {shell, start, []} is the default shell, but when I  
> read the related source it had a lot of code dealing with shell  
> specific code, and I could not easily figure out exactly what  
> messages the ssh module expects it to respond to. Can anyone tell me  
> exactly what kind of behavior a replacement module requires for the  
> ssh module to work correctly?
>
> Furthermore, does anyone see anything that makes the ssh module  
> unsuitable for what I'd like to do?
>
> Also, just to point something out, when I start the ssh server, the  
> server will crash if I do not have DSA keys in the system directory.  
> Having RSA keys only does not work and, in fact, I am not certain  
> the daemon is capable of using RSA keys server side.
>
> Charles_______________________________________________
> erlang-questions mailing list
> 
> http://www.erlang.org/mailman/listinfo/erlang-questions




More information about the erlang-questions mailing list