KDESu::SshProcess Class

Executes a remote command, using ssh. More...

Header: #include <KDESu/SshProcess>
CMake: find_package(KF6 REQUIRED COMPONENTS Su)
target_link_libraries(mytarget PRIVATE KF6::Su)
Inherits: KDESu::StubProcess

Public Types

enum Errors { SshNotFound, SshNeedsPassword, SshIncorrectPassword }

Public Functions

SshProcess(const QByteArray &host = QByteArray(), const QByteArray &user = QByteArray(), const QByteArray &command = QByteArray())
int checkInstall(const char *password)
int checkNeedPassword()
QByteArray error() const
int exec(const char *password, int check = 0)
QByteArray prompt() const
void setHost(const QByteArray &host)
void setStub(const QByteArray &stub)

Detailed Description

Member Type Documentation

enum SshProcess::Errors

ConstantValue
KDESu::SshProcess::SshNotFound1
KDESu::SshProcess::SshNeedsPassword2
KDESu::SshProcess::SshIncorrectPassword3

Member Function Documentation

[explicit] SshProcess::SshProcess(const QByteArray &host = QByteArray(), const QByteArray &user = QByteArray(), const QByteArray &command = QByteArray())

int SshProcess::checkInstall(const char *password)

Checks if the stub is installed and if the password is correct.

Returns zero if everything is correct, nonzero otherwise.

int SshProcess::checkNeedPassword()

Checks if the current user@host needs a password.

Returns the prompt for the password if a password is required. A null string otherwise.

QByteArray SshProcess::error() const

int SshProcess::exec(const char *password, int check = 0)

Executes the command.

QByteArray SshProcess::prompt() const

void SshProcess::setHost(const QByteArray &host)

Sets the target host.

void SshProcess::setStub(const QByteArray &stub)

Sets the location of the remote stub.