simplessh-0.1.0.0: Simple wrapper around libssh2

Safe HaskellSafe-Inferred
LanguageHaskell98

Network.SSH.Client.SimpleSSH

Synopsis

Documentation

data Result Source

The result of a command execution.

Constructors

Result 

Fields

resultOut :: ByteString

The process' stdout

resultErr :: ByteString

The process' stderr

resultExit :: ResultExit

The process' exit code or signal

Instances

data ResultExit Source

Exit code or signal of a process.

openSession Source

Arguments

:: String

Hostname

-> Integer

Port

-> String

Path to the known hosts (e.g. ~.sshknown_hosts)

-> SimpleSSH Session 

Open a SSH session. The next step is to authenticate.

authenticateWithPassword Source

Arguments

:: Session

Session to use

-> String

Username

-> String

Password

-> SimpleSSH Session 

Authenticate with a public key for a given username.

Leave the passphrase empty if not needed.

Authenticate a session with a pair username / password.

authenticateWithKey Source

Arguments

:: Session

Session to use

-> String

Username

-> FilePath

Path to the public key (e.g. ~.sshid_rsa.pub)

-> FilePath

Path to the private key (e.g. ~.sshid_rsa)

-> String

Passphrase

-> SimpleSSH Session 

execCommand Source

Arguments

:: Session

Session to use

-> String

Command

-> SimpleSSH Result 

Send a command to the server.

One should be authenticated before sending commands on a Session.

sendFile Source

Arguments

:: Session

Session to use

-> Integer

File mode (e.g. 0o777, note the octal notation)

-> String

Source path

-> String

Target path

-> SimpleSSH Integer 

Send a file to the server and returns the number of bytes transferred.

One should be authenticated before sending files on a 'Session.

closeSession :: Session -> SimpleSSH () Source

Close a session.

withSessionPassword Source

Arguments

:: String

Hostname

-> Integer

Port

-> String

Path to known_hosts

-> String

Username

-> String

Password

-> (Session -> SimpleSSH a)

Monadic action on the session

-> SimpleSSH a 

Open a connection, authenticate, execute some action and close the connection.

It is the safe way of using SimpleSSH. This function is to be used to authenticate with a pair username / password, otherwise see withSessionKey.

withSessionKey Source

Arguments

:: String

Hostname

-> Integer

port

-> String

Path to known_hosts

-> String

Username

-> String

Path to public key

-> String

Path to private key

-> String

Passphrase

-> (Session -> SimpleSSH a)

Monadic action on the session

-> SimpleSSH a 

Open a connection, authenticate, execute some action and close the connection.

It is the safe way of using SimpleSSH. This function is to be used to authenticate with a key, otherwise see withSessionPassword.