[][src]Struct openssh::Session

pub struct Session { /* fields omitted */ }

A single SSH session to a remote host.

You can use [command] to start a new command on the connected machine.

When the Session is dropped, the connection to the remote host is severed, and any errors silently ignored. To disconnect and be alerted to errors, use [close].

Methods

impl Session[src]

pub fn connect(destination: &str, check: KnownHosts) -> Result<Self, Error>[src]

Connect to the host at the given addr over SSH.

The format of destination is the same as the destination argument to ssh. It may be specified as either [user@]hostname or a URI of the form ssh://[user@]hostname[:port].

If connecting requires interactive authentication based on STDIN (such as reading a password), the connection will fail. Consider setting up keypair-based authentication instead.

pub fn check(&self) -> Result<(), Error>[src]

Check the status of the underlying SSH connection.

Since this does not run a remote command, it has a better chance of extracting useful error messages than other commands.

pub fn command<S: AsRef<OsStr>>(&self, program: S) -> Command[src]

Constructs a new Command for launching the program at path program on the remote host.

The returned Command is a builder, with the following default configuration:

  • No arguments to the program
  • Inherit the current process's environment
  • Inherit the current process's working directory
  • Inherit stdin/stdout/stderr for spawn or status, but create pipes for output

Builder methods are provided to change these defaults and otherwise configure the process.

If program is not an absolute path, the PATH will be searched in an OS-defined way on the host.

pub fn close(self) -> Result<(), Error>[src]

Terminate the remote connection.

Trait Implementations

impl Debug for Session[src]

impl Drop for Session[src]

Auto Trait Implementations

impl RefUnwindSafe for Session

impl Send for Session

impl Sync for Session

impl Unpin for Session

impl UnwindSafe for Session

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,