| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell98 |
Network.SSH.Client.SimpleSSH
- data SimpleSSHError
- type SimpleSSH a = ErrorT SimpleSSHError IO a
- data Session
- data Result = Result {}
- data ResultExit
- runSimpleSSH :: SimpleSSH a -> IO (Either SimpleSSHError a)
- withSessionPassword :: String -> Integer -> String -> String -> String -> (Session -> SimpleSSH a) -> SimpleSSH a
- withSessionKey :: String -> Integer -> String -> String -> String -> String -> String -> (Session -> SimpleSSH a) -> SimpleSSH a
- execCommand :: Session -> String -> SimpleSSH Result
- sendFile :: Session -> Integer -> String -> String -> SimpleSSH Integer
- openSession :: String -> Integer -> String -> SimpleSSH Session
- authenticateWithPassword :: Session -> String -> String -> SimpleSSH Session
- authenticateWithKey :: Session -> String -> FilePath -> FilePath -> String -> SimpleSSH Session
- closeSession :: Session -> SimpleSSH ()
Data types
data SimpleSSHError Source
Constructors
| Connect | |
| Init | |
| Handshake | |
| KnownhostsInit | |
| KnownhostsHostkey | |
| KnownhostsCheck | |
| Authentication | |
| ChannelOpen | |
| ChannelExec | |
| Read | |
| FileOpen | |
| Write | |
| Unknown |
Instances
type SimpleSSH a = ErrorT SimpleSSHError IO a Source
The result of a command execution.
Constructors
| Result | |
Fields
| |
data ResultExit Source
Exit code or signal of a process.
Constructors
| ExitSuccess | |
| ExitFailure Integer | |
| ExitSignal ByteString |
Instances
Main functions
runSimpleSSH :: SimpleSSH a -> IO (Either SimpleSSHError a) 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.
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.
Send a command to the server.
One should be authenticated before sending commands on a Session.
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.
Lower-level functions
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
Authenticate with a public key for a given username.
Leave the passphrase empty if not needed.
Authenticate a session with a pair username / password.
closeSession :: Session -> SimpleSSH () Source
Close a session.