Struct Session

Source
pub struct Session { /* private fields */ }

Implementations§

Source§

impl Session

Source

pub fn new() -> Result<Session, ()>

Source

pub fn set_host(&mut self, v: &str) -> Result<(), Error>

Source

pub fn set_port(&mut self, v: usize) -> Result<(), Error>

Source

pub fn set_username(&mut self, v: &str) -> Result<(), Error>

Source

pub fn set_ssh_dir<P: AsRef<Path>>(&mut self, v: P) -> Result<(), Error>

Set the location of the “.ssh” directory, where the config file and keys can be found (it may include “%s”, which will be replaced by the user home directory).

Source

pub fn set_knownhosts<P: AsRef<Path>>(&mut self, v: P) -> Result<(), Error>

Set the location of the “knownhosts” file (it may include “%s”, which will be replaced by the user home directory).

Source

pub fn set_identity<P: AsRef<Path>>(&mut self, v: P) -> Result<(), Error>

Set the location of the key to be used for authentication (it may include “%s”, which will be replaced by the user home directory).

Source

pub fn set_ssh1(&mut self, v: bool) -> Result<(), Error>

Allow version 1 of the protocol (default unspecified).

Source

pub fn set_ssh2(&mut self, v: bool) -> Result<(), Error>

Allow version 1 of the protocol (default unspecified).

Source

pub fn parse_config(&mut self, path: Option<&Path>) -> Result<(), Error>

Parse configuration file. If the path is None, then ~/.ssh/config is read.

Source

pub fn is_server_known(&mut self) -> Result<ServerKnown, Error>

Check whether the remote server’s key is known.

Source

pub fn write_knownhost(&mut self) -> Result<(), Error>

Accept the remote server’s key.

Source

pub fn get_pubkey_hash(&mut self) -> Result<Vec<u8>, Error>

Get a hash of the server’s public key

Source

pub fn connect(&mut self) -> Result<(), Error>

Source

pub fn disconnect(&mut self) -> Result<(), Error>

Disconnect the session. The session can be reused later to open a new session.

Source

pub fn userauth_password(&mut self, p: &str) -> Result<(), Error>

Authenticate with a password.

Source

pub fn userauth_kbdint(&mut self, user: Option<&str>) -> Result<(), Error>

Print a prompt on the standard output, and then ask the user a password on the standard input. The typed password is not echoed.

Source

pub fn userauth_publickey_auto(&mut self, p: Option<&str>) -> Result<(), Error>

Print a prompt on the standard output, and then ask the user a password on the standard input. The typed password is not echoed.

Source

pub fn scp_new<'b, P: AsRef<Path>>( &'b mut self, mode: Mode, v: P, ) -> Result<Scp<'b>, Error>

Start an SCP connection.

Source

pub fn channel_new<'b>(&'b mut self) -> Result<Channel<'b>, Error>

Start a channel to issue remote commands.

Trait Implementations§

Source§

impl Debug for Session

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Drop for Session

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.