Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell98 |
- data SimpleSSHError
- type SimpleSSH a = ErrorT SimpleSSHError IO a
- data Session
- data Result = Result {}
- data ResultExit
- runSimpleSSH :: SimpleSSH a -> IO (Either SimpleSSHError a)
- openSession :: String -> Integer -> String -> SimpleSSH Session
- authenticateWithPassword :: Session -> String -> String -> SimpleSSH Session
- authenticateWithKey :: Session -> String -> FilePath -> FilePath -> String -> SimpleSSH Session
- execCommand :: Session -> String -> SimpleSSH Result
- sendFile :: Session -> Integer -> String -> String -> SimpleSSH Integer
- closeSession :: Session -> SimpleSSH ()
- withSessionPassword :: String -> Integer -> String -> String -> String -> (Session -> SimpleSSH a) -> SimpleSSH a
- withSessionKey :: String -> Integer -> String -> String -> String -> String -> String -> (Session -> SimpleSSH a) -> SimpleSSH a
Documentation
data SimpleSSHError Source
type SimpleSSH a = ErrorT SimpleSSHError IO a Source
The result of a command execution.
Result | |
|
data ResultExit Source
Exit code or signal of a process.
runSimpleSSH :: SimpleSSH a -> IO (Either SimpleSSHError a) Source
:: 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.
Send a command to the server.
One should be authenticated before sending commands on a Session
.
:: 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.
:: 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
.
:: 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
.