[erlang-questions] scp subsystem

Stefan Jahn stefan@REDACTED
Tue Mar 19 14:02:14 CET 2013


dear erlang'ers,

after reading some documentation on ssh otp system I ended up with:

    ssh:daemon({0,0,0,0}, 45678, [{pwdfun, fun auth/2},
%% create server keys:
%% ssh-keygen -f /tmp/ssh/ssh_host_rsa_key -N '' -t rsa
%% ssh-keygen -f /tmp/ssh/ssh_host_dsa_key -N '' -t dsa
				  {system_dir, "/tmp/ssh"},
				  {user_dir, "/tmp/ssh"},
%				  {ssh_cli,{ssh_cli, {ssh_scpd, []}}},
				  {auth_methods, "keyboard-interactive,password"},
				  {subsystems, [
						ssh_scpd:subsystem_spec([])
%						ssh_sftpd:subsystem_spec([{vsn, 3}])
					       ]}]).

whereas the ssh_scpd module is base on the ssh_sftpd module from otp, i.e.

-module(ssh_scpd).
%-behaviour(ssh_daemon_channel).
-behaviour(ssh_channel).

-define(UINT32(X), X:32/unsigned-big-integer).

%% External exports
-export([subsystem_spec/1]).

%% Callbacks
-export([init/1, handle_ssh_msg/2, handle_msg/2, terminate/2,
code_change/3]).

implementing the callbacks similar to what we have in ssh_sftpd...

now, when I start

$ scp -P 45678 README ssh@REDACTED:README

authentification works fine as implemented in auth/2, but somehow
the ssh channel behaviour is not used at all.

ssh@REDACTED's password:
{error,{1,erl_parse,["syntax error before: ",[]]}}
$ Received disconnect from 127.0.0.1: 11: Application shutdown

It seems like scp commands are send into the standard erlang shell (which
I did not specify) and not into the channel.

I am using R15B2.

Could please someone help out here and give me some hint where to
proceed reading?

Also an abstract description of the difference between the purposes of
ssh_cli and subsystems options would be appriciated.

Thank you in advance,
  Stefan.






More information about the erlang-questions mailing list