jerry
December 30, 2021, 5:38pm
1
Hello,
Any ideas how I can use SFTPClient to connect to a remote host using IP, Port, username, password, timeout, and passphrase connection parameters?
Upon successful connection, upload a file to the remote host as well.
I have tried doing this without success
Grateful for any assistance in this regard.
Regards,
Jerry
al2o3cr
December 30, 2021, 6:10pm
2
The parameters you listed seem to line up with the ones that SFTPClient.connect
expects; can you provide more specifics on how the connection fails?
jerry
December 30, 2021, 6:12pm
3
Hello @al2o3cr ,
Below is the response I get:
** (FunctionClauseError) no function clause matching in :ssh.connect/4
The following arguments were given to :ssh.connect/4:
# 1
'X.X.X.X'
# 2
"XXX"
# 3
[
user_interaction: false,
silently_accept_hosts: true,
quiet_mode: true,
inet: :inet,
connect_timeout: 5000
]
# 4
5000
(ssh 4.10) ssh.erl:158: :ssh.connect/4
(ssh 4.10) ssh_sftp.erl:206: :ssh_sftp.start_channel/3
(sftp_client 1.4.6) lib/sftp_client/operations/connect.ex:139: SFTPClient.Operations.Connect.do_connect/1
(sftp_client 1.4.6) lib/sftp_client/operations/connect.ex:53: SFTPClient.Operations.Connect.connect/1
jerry
December 30, 2021, 6:16pm
4
Connection is as below:
SFTPClient.connect(host: host, port: port, user: user, password: pass, connect_timeout: 50000, operation_timeout: 50000)
Grateful for your response.
Kind regards,
Jerry
al2o3cr
December 30, 2021, 6:22pm
5
jerry:
# 2
"XXX"
The documentation for :ssh.connect/4
specifies that the second argument should be a :inet.port_number()
- an integer 0..65535
. The double-quotes here suggest you are passing a binary instead.
1 Like
jerry
December 30, 2021, 6:25pm
6
Kindly let me check and try again.
Thank you