Pages
API Documentation
On this page

KDESu::SuProcess Class

Executes a command under elevated privileges, using su. More...

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

List of all members, including inherited members

Public Types

Public Functions

Detailed Description

Member Type Documentation

enum SuProcess::Errors

Constant
KDESu::SuProcess::SuNotFound 1
KDESu::SuProcess::SuNotAllowed 2
KDESu::SuProcess::SuIncorrectPassword 3

enum SuProcess::checkMode

Executes the command. This will wait for the command to finish.

Constant
KDESu::SuProcess::NoCheck 0
KDESu::SuProcess::Install 1
KDESu::SuProcess::NeedPassword 2

Member Function Documentation

[explicit] SuProcess::SuProcess(const QByteArray &user = nullptr, const QByteArray &command = nullptr)

int SuProcess::checkInstall(const char *password)

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

Returns zero if everything is correct, nonzero otherwise.

int SuProcess::checkNeedPassword()

Checks if a password is needed.

int SuProcess::exec(const char *password, int check = NoCheck)

QString SuProcess::superUserCommand()

Checks what the default super user command is, e.g. sudo, su, etc

Returns the default super user command

bool SuProcess::useUsersOwnPassword()

Checks whether or not the user's password is being asked for or another user's password. Due to usage of systems such as sudo, even when attempting to switch to another user one may need to enter their own password.

We use cookies to personalize content and to analyze our traffic. Please decide if you are willing to accept cookies from our website.