View Source SFTPClient.Operations.Connect (SFTP Client v2.1.0)
A module containing operations to connect to an SSH/SFTP server.
Summary
Functions
Connects to an SSH server and opens an SFTP channel.
Connects to an SSH server and opens an SFTP channel, then runs the function
and closes the connection when finished. Accepts the same options as
connect/1
.
Connects to an SSH server and opens an SFTP channel. Accepts the same options
as connect/1
. Raises when the connection fails.
Connects to an SSH server and opens an SFTP channel, then runs the function
and closes the connection when finished. Accepts the same options as
connect/1
. Raises when the connection fails.
Functions
@spec connect(SFTPClient.Config.t() | Keyword.t() | %{optional(atom()) => any()}) :: {:ok, SFTPClient.Conn.t()} | {:error, term()}
Connects to an SSH server and opens an SFTP channel.
Options
:host
(required) - The host of the SFTP server.:port
- The port of the SFTP server, defaults to 22.:user
- The user to authenticate as, when omitted tries to determine the current user.:password
- The password for the user.:user_dir
- The directory to read private keys from.:dsa_pass_phrase
- The passphrase for an DSA private key from the specified user dir.:rsa_pass_phrase
- The passphrase for an RSA private key from the specified user dir.:ecdsa_pass_phrase
- The passphrase for an ECDSA private key from the specified user dir.:private_key_path
- The path to the private key to use for authentication.:private_key_pass_phrase
- The passphrase that is used to decrypt the specified private key.:inet
- The IP version to use, either:inet
(default) or:inet6
.:sftp_vsn
- The SFTP version to be used.:connect_timeout
- The connection timeout in milliseconds (defaults to 5000 ms), can be set to:infinity
to disable timeout.:operation_timeout
- The operation timeout in milliseconds (defaults to 5000 ms), can be set to:infinity
to disable timeout.:key_cb
- A 2-item tuple containing:- A module that implements
:ssh_client_key_api
behaviour. :ssh_client_key_api
behaviour opts.
- A module that implements
:modify_algorithms
- An option passed to the underlying Erlang SSH implementation to support non-OTP default encryption algorithms. To re-enablediffie-hellman-group1-sha1
, removed in OTP 23, pass:modify_algorithms: [append: [kex: [:"diffie-hellman-group1-sha1"]]]
:preferred_algorithms
- Replace the default set of algorithms.:packet_size
- Modify the TCP layer packet size.
@spec connect( SFTPClient.Config.t() | Keyword.t() | %{optional(atom()) => any()}, (SFTPClient.Conn.t() -> res) ) :: {:ok, res} | {:error, SFTPClient.error()} when res: var
Connects to an SSH server and opens an SFTP channel, then runs the function
and closes the connection when finished. Accepts the same options as
connect/1
.
@spec connect!(SFTPClient.Config.t() | Keyword.t() | %{optional(atom()) => any()}) :: SFTPClient.Conn.t() | no_return()
Connects to an SSH server and opens an SFTP channel. Accepts the same options
as connect/1
. Raises when the connection fails.
@spec connect!( SFTPClient.Config.t() | Keyword.t() | %{optional(atom()) => any()}, (SFTPClient.Conn.t() -> res) ) :: res | no_return() when res: var
Connects to an SSH server and opens an SFTP channel, then runs the function
and closes the connection when finished. Accepts the same options as
connect/1
. Raises when the connection fails.