This service can be used to:
endpoint: Set the endpoint for connection. The format is same as openssh, using either [user@]hostname or ssh://[user@]hostname[:port]. A username or port that is specified in the endpoint overrides the one set in the builder (but does not change the builder).root: Set the work directory for backend. It uses the default directory set by the remote sftp-server as defaultuser: Set the login userkey: Set the file path to the private key for authenticationknown_hosts_strategy: Set the strategy for known hosts, default to Strictenable_copy: Deprecated. SFTP copy capability is enabled by default and this option is no longer needed.For security reasons, it doesn't support password login. Use SSH key-based authentication (e.g., configure your public key on the server via ssh-copy-id and provide the private key here).
You can refer to [SftpBuilder]'s docs for more information
use anyhow::Result; use opendal_service_sftp::Sftp; use opendal_core::Operator; #[tokio::main] async fn main() -> Result<()> { let mut builder = Sftp::default() .endpoint("127.0.0.1") .user("test") .key("test_key"); let op: Operator = Operator::new(builder)?; Ok(()) }