[erlang-questions] SFTP

bengt cean.ebengt@REDACTED
Mon Jan 30 19:01:04 CET 2017


Greetings,

Can you try with sshd, instead of ssh_sftpd ? As a way of halving the potential error sources. Also, which Erlang version are you on?


bengt

> On 30 Jan 2017, at 13:55, Karolis Petrauskas <k.petrauskas@REDACTED> wrote:
> 
> Hello,
> 
> I'm trying to use erlang's sftp server and client. In the example
> bellow, i use erlang for both: the server and the client. For some
> reason, i can't open some files.
> 
>    43> ssh_sftp:list_dir(Ch, ".").
>    {ok,["other.txt","some.txt"]}
> 
>    44> ssh_sftp:read_file(Ch, "some.txt").
>    {ok,<<"some.txt contents">>}
> 
>    45> ssh_sftp:read_file(Ch, "other.txt").
>    {error,no_such_file}
> 
> I was able to read both files with absolute file names specified, but
> in my case I should not depend on the absolute paths. I could use the
> absolute file names when opening files, if I could get the current
> working directory from the server, but I cant find any function for
> that.
> 
> The server behaviour is also a unclear to me. I can't set the cwd, if
> the root option is used when starting the daemon. I have tried various
> combinations of root/cwd (cwd is relative to root, or absolute on the
> target file system), the sftp client always logins with / as its
> current working directory.
> 
> In my case, I use the sftpd only for testing the sftp client in CT.
> I'm working on Erlang/OTP 19 [erts-8.2].
> 
> Would be thankful for any pointers.
> 
> Karolis
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions




More information about the erlang-questions mailing list