[erlang-questions] SFTP

Karolis Petrauskas <>
Mon Jan 30 21:19:03 CET 2017


I'm using "Erlang/OTP 19 [erts-8.2]", debian package from
erlang-solutions, version 1:19.2-1.

I'll check that with erlang client and sshd server. I was playing with
ssh_sftpd server from a command line (sftp), and noticed no problems
except the cwd problem when combined with root directory restriction.

Karolis

On Mon, Jan 30, 2017 at 8:01 PM, bengt <> wrote:
> 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 <> 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
>> 
>> http://erlang.org/mailman/listinfo/erlang-questions
>
> _______________________________________________
> erlang-questions mailing list
> 
> http://erlang.org/mailman/listinfo/erlang-questions


More information about the erlang-questions mailing list