Setting PubkeyAuthentication=no in SFTP connection

Hello! I’m using the sftp_ex library (which is a wrapper around Erlang SFTP) and there’s a server I want to connect to that will not accept pub key authentication, in such an strict way that even when I’m passing user and password, it will reject the connection if a pub key is also passed in.

When using sftp directly, I can pass the -o PubkeyAuthentication=no option to avoid including the pub key, but I haven’t found how to do that in Elixir / Erlang.

A workaround is setting user_dir to point to an existing directory that doesn’t contain any pub keys, for example /tmp, this way it looks there and as it doesn’t find any, none is passed and the connection is accepted.

Do you know a way to set the PubkeyAuthentication=no when connecting via Erlang SFTP?

1 Like

Given my limited experience with the module this seems to be “the way” and not a workaround. I was looking into passing private keys I have in memory, but it seems “having a folder of keys” is the expected way to handle them.

1 Like