Warning, /plasma/kde-cli-tools/doc/kdesu/index.docbook is written in an unsupported language. File is not indexed.

0001 <?xml version="1.0" ?>
0002 <!DOCTYPE book PUBLIC "-//KDE//DTD DocBook XML V4.5-Based Variant V1.1//EN"
0003 "dtd/kdedbx45.dtd" [
0004   <!ENTITY kappname "&kdesu;">
0005   <!ENTITY package "kdebase">
0006   <!ENTITY % addindex "IGNORE">
0007   <!ENTITY % English "INCLUDE" > <!-- change language only here -->
0008 ]>
0009 
0010 <book id="kdesu" lang="&language;">
0011 <bookinfo>
0012 
0013 <title>The &kdesu; handbook</title>
0014 
0015 <authorgroup>
0016 <author>&Geert.Jansen; &Geert.Jansen.mail;</author>
0017 <!-- TRANS:ROLES_OF_TRANSLATORS -->
0018 </authorgroup>
0019 
0020 <copyright>
0021 <year>2000</year>
0022 <holder>&Geert.Jansen;</holder>
0023 </copyright>
0024 
0025 <legalnotice>&FDLNotice;</legalnotice>
0026 
0027 <date>2010-09-21</date>
0028 <releaseinfo>KDE 4.5</releaseinfo>
0029 
0030 
0031 <abstract><para>&kdesu; is a graphical front end for the &UNIX;
0032 <command>su</command> command.</para></abstract>
0033 
0034 <keywordset>
0035 <keyword>KDE</keyword>
0036 <keyword>su</keyword>
0037 <keyword>password</keyword>
0038 <keyword>root</keyword>
0039 </keywordset>
0040 
0041 </bookinfo>
0042 
0043 <chapter id="introduction">
0044 <title>Introduction</title>
0045 
0046 <!-- from kdebase/runtime/kdesu/FAQ since rev 855297
0047 kdesu is a libexec program, so does not normally reside in your PATH.
0048 Use something like:
0049 <command>$(kf5-config - -path libexec)kdesu - - program_to_run
0050 
0051 https://bugs.kde.org/show_bug.cgi?id=194267
0052 "one needs to create a
0053 ~/.kde/share/config/kdesurc file to tell KDE to use sudo instead of su."
0054 ~/.kde/share/config/kdesurc
0055 [super-user-command]
0056 super-user-command=sudo
0057 does this really work?
0058 -->
0059 
0060 <para>Welcome to &kdesu;! &kdesu; is a graphical front end for the
0061 &UNIX; <command>su</command> command for the K Desktop Environment.
0062 It allows you to run a program as different user by supplying the
0063 password for that user. &kdesu; is an unprivileged program; it uses
0064 the system's <command>su</command>.</para>
0065 
0066 <para>&kdesu; has one additional feature: it can remember passwords
0067 for you. If you are using this feature, you only need to enter the
0068 password once for each command. See <xref
0069 linkend="sec-password-keeping"/> for more information on this and a
0070 security analysis.</para>
0071 
0072 <para>This program is meant to be started from the command line or
0073 from <filename>.desktop</filename> files. Although it asks for the
0074 <systemitem class="username">root</systemitem> password using a &GUI;
0075 dialog, I consider it to be more of a command line &lt;-&gt; &GUI;
0076 glue instead of a pure &GUI; program.</para>
0077 
0078 <para>Since <command>kdesu</command> is no longer installed in <userinput>
0079 $(kf5-config --prefix)</userinput>/bin but in <userinput>kf5-config --path libexec</userinput>
0080 and therefore not in your <envar>Path</envar>, you have to use <userinput>$(kf5-config
0081 --path libexec)<command>kdesu</command></userinput> to launch <command>kdesu</command>.</para>
0082 </chapter>
0083 
0084 <chapter id="using-kdesu">
0085 <title>Using &kdesu;</title>
0086 
0087 <para>Usage of &kdesu; is easy. The syntax is like this:</para>
0088 
0089 <cmdsynopsis>
0090 <command>kdesu</command>
0091 
0092 <group choice="opt"><option>-c</option> <replaceable> command</replaceable></group>
0093 <group choice="opt"><option>-d</option></group>
0094 <group choice="opt"><option>-f</option> <replaceable> file</replaceable></group>
0095 <group choice="opt"><option>-i</option> <replaceable> icon name</replaceable></group>
0096 <group choice="opt"><option>-n</option></group>
0097 <group choice="opt"><option>-p</option> <replaceable> priority</replaceable></group>
0098 <group choice="opt"><option>-r</option></group>
0099 <group choice="opt"><option>-s</option></group>
0100 <group choice="opt"><option>-t</option></group>
0101 <group choice="opt"><option>-u</option> <replaceable> user</replaceable></group>
0102 <group choice="opt"><option>--noignorebutton</option></group>
0103 <group choice="opt"><option>--attach</option> <replaceable> winid</replaceable></group>
0104 <!--group choice="opt"><option>- -nonewdcop</option></group>
0105 
0106 <group><arg choice="req"><replaceable>command</replaceable> <arg><replaceable>arg1</replaceable></arg>
0107           <arg><replaceable>arg2</replaceable></arg>
0108           <arg rep="repeat"><replaceable></replaceable></arg></arg></group-->
0109 </cmdsynopsis>
0110 <cmdsynopsis>
0111 <command>kdesu</command>
0112 <arg choice="opt">&kde; Generic Options</arg>
0113 <arg choice="opt">&Qt; Generic Options</arg>
0114 </cmdsynopsis>
0115 
0116 <para>The command line options are explained below.</para>
0117 
0118 <variablelist>
0119 <varlistentry>
0120 <term><option>-c <replaceable>command</replaceable></option></term>
0121 <listitem><para>This specifies the command to run as root. It has to be passed
0122 in one argument. So if, for example, you want to start a new file manager, you
0123 would enter at the prompt: <userinput>$(kf5-config --path libexec)<command>kdesu <option>-c <replaceable>
0124 &dolphin;</replaceable></option></command></userinput></para></listitem>
0125 </varlistentry>
0126 <varlistentry>
0127 <term><option>-d</option></term>
0128 <listitem><para>Show debug information.</para></listitem>
0129 </varlistentry>
0130 <varlistentry>
0131 <term><option>-f <replaceable>file</replaceable></option></term>
0132 <listitem><para>This option allow efficient use of &kdesu; in
0133 <filename>.desktop</filename> files. It tells &kdesu; to examine the
0134 file specified by <parameter>file</parameter>. If this file is
0135 writable by the current user, &kdesu; will execute the command as the
0136 current user. If it is not writable, the command is executed as user
0137 <parameter>user</parameter> (defaults to root).</para>
0138 <para><parameter>file</parameter> is evaluated like this: if
0139 <parameter>file</parameter> starts with a <literal>/</literal>, it is
0140 taken as an absolute filename. Otherwise, it is taken as the name of a
0141 global &kde; configuration file.</para></listitem>
0142 </varlistentry>
0143 <varlistentry>
0144 <term><option>-i</option> <replaceable>icon name</replaceable></term>
0145 <listitem><para>Specify icon to use in the password dialog.  You may specify
0146 just the name, without any extension.</para>
0147 <para>For instance to run &konqueror; in filemanager mode and show the
0148 &konqueror; icon in the password dialog:</para>
0149 <screen><userinput>$(kf5-config --path libexec)<command>kdesu</command>  <option>-i konqueror</option>
0150 <option>-c "konqueror --profile filemanagement"</option></userinput></screen>
0151 </listitem>
0152 </varlistentry>
0153 
0154 <varlistentry>
0155 <term><option>-n</option></term>
0156 <listitem><para>Do not keep the password. This disables the <guilabel>keep
0157 password</guilabel> checkbox in the password dialog.</para></listitem>
0158 </varlistentry>
0159 <varlistentry>
0160 <term><option>-p</option> <replaceable>priority</replaceable></term>
0161 <listitem>
0162 <para>Set priority value.  The priority is an arbitrary number between 0 and
0163 100, where 100 means highest priority, and 0 means lowest.  The default is
0164 50.</para>
0165 </listitem>
0166 </varlistentry>
0167 <varlistentry>
0168 <term><option>-r</option></term>
0169 <listitem><para>Use realtime scheduling.</para>
0170 </listitem>
0171 </varlistentry>
0172 
0173 <varlistentry>
0174 <term><option>-s</option></term>
0175 <listitem><para>Stop the kdesu daemon. See <xref
0176 linkend="sec-password-keeping"/>.</para></listitem>
0177 </varlistentry>
0178 <varlistentry>
0179 <term><option>-t</option></term>
0180 <listitem><para>Enable terminal output. This disables password keeping. This is
0181 largely for debugging purposes; if you want to run a console mode app, use the
0182 standard <command>su</command> instead.</para> </listitem>
0183 </varlistentry>
0184 <varlistentry>
0185 <term><option>-u</option> <replaceable> user</replaceable></term>
0186 <listitem><para>While the most common use for &kdesu; is to run a command as
0187 the superuser, you can supply any user name and the appropriate
0188 password.</para>
0189 </listitem>
0190 </varlistentry>
0191 
0192 </variablelist>
0193 
0194 </chapter>
0195 
0196 <chapter id="Internals">
0197 <title>Internals</title>
0198 
0199 <sect1 id="x-authentication">
0200 <title>X authentication</title>
0201 
0202 <para>The program you execute will run under the root user id and will
0203 generally have no authority to access your X display. &kdesu; gets
0204 around this by adding an authentication cookie for your display to a
0205 temporary <filename>.Xauthority</filename> file. After the command
0206 exits, this file is removed. </para>
0207 
0208 <para>If you don't use X cookies, you are on your own. &kdesu; will
0209 detect this and will not add a cookie but you will have to make sure
0210 that root is allowed to access to your display.</para>
0211 
0212 </sect1>
0213 
0214 <sect1 id="interface-to-su">
0215 <title>Interface to <command>su</command></title>
0216 
0217 <para>&kdesu; uses the sytem's <command>su</command> for acquiring
0218 priviliges. In this section, I explain the details of how &kdesu; does
0219 this. </para>
0220 
0221 <para>Because some <command>su</command> implementations (&ie; the one
0222 from &RedHat;) don't want to read the password from
0223 <literal>stdin</literal>, &kdesu; creates a pty/tty pair and executes
0224 <command>su</command> with its standard filedescriptors connected to
0225 the tty.</para>
0226 
0227 <para>To execute the command the user selected, rather than an
0228 interactive shell, &kdesu; uses the <option>-c</option> argument with
0229 <command>su</command>. This argument is understood by every shell that
0230 I know of so it should work portably. <command>su</command> passes
0231 this <option>-c</option> argument to the target user's shell, and the
0232 shell executes the program. Example command: <command>su <option>root
0233 -c <replaceable>the_program</replaceable></option></command>.</para>
0234 
0235 <para>Instead of executing the user command directly with
0236 <command>su</command>, &kdesu; executes a little stub program called
0237 <application>kdesu_stub</application>. This stub (running as the
0238 target user), requests some information from &kdesu; over the pty/tty
0239 channel (the stub's stdin and stdout) and then executes the user's
0240 program. The information passed over is: the X display, an X
0241 authentication cookie (if available), the <envar>PATH</envar> and the
0242 command to run. The reason why a stub program is used is that the X
0243 cookie is private information and therefore cannot be passed on the
0244 command line.</para>
0245 
0246 </sect1>
0247 
0248 <sect1 id="password-checking">
0249 <title>Password Checking</title>
0250 
0251 <para>&kdesu; will check the password you entered and gives an error
0252 message if it is not correct. The checking is done by executing a test
0253 program: <filename>/bin/true</filename>. If this succeeds, the
0254 password is assumed to be correct.</para>
0255 
0256 </sect1>
0257 
0258 <sect1 id="sec-password-keeping">
0259 <title>Password Keeping</title>
0260 
0261 <para>For your comfort, &kdesu; implements a <quote>keep
0262 password</quote> feature. If you are interested in security, you
0263 should read this paragraph.</para>
0264 
0265 <para>Allowing &kdesu; to remember passwords opens up a (small)
0266 security hole in your system. Obviously, &kdesu; does not allow
0267 anybody but your user id to use the passwords, but, if done without
0268 caution, this would lowers <systemitem
0269 class="username">root</systemitem>'s security level to that of a
0270 normal user (you). A hacker who breaks into your account, would get
0271 <systemitem class="username">root</systemitem> access. &kdesu; tries
0272 to prevent this. The security scheme it uses is, in my opinion at
0273 least, reasonably safe and is explained here.</para>
0274 
0275 <para>&kdesu; uses a daemon, called
0276 <application>kdesud</application>. The daemon listens to a &UNIX;
0277 socket in <filename>/tmp</filename> for commands. The mode of the
0278 socket is 0600 so that only your user id can connect to it. If
0279 password keeping is enabled, &kdesu; executes commands through this
0280 daemon. It writes the command and <systemitem
0281 class="username">root</systemitem>'s password to the socket and the
0282 daemon executes the command using <command>su</command>, as describe
0283 before. After this, the command and the password are not thrown
0284 away. Instead, they are kept for a specified amount of time. This is
0285 the timeout value from in the control module.  If another request for
0286 the same command is coming within this time period, the client does
0287 not have to supply the password. To keep hackers who broke into your
0288 account from stealing passwords from the daemon (for example, by
0289 attaching a debugger), the daemon is installed set-group-id
0290 nogroup. This should prevent all normal users (including you) from
0291 getting passwords from the <application>kdesud</application>
0292 process. Also, the daemon sets the <envar>DISPLAY</envar> environment
0293 variable to the value it had when it was started. The only thing a
0294 hacker can do is execute an application on your display.</para>
0295 
0296 <para>One weak spot in this scheme is that the programs you execute
0297 are probably not written with security in mind (like setuid
0298 <systemitem class="username">root</systemitem> programs). This means
0299 that they might have buffer overruns or other problems and a hacker
0300 could exploit those.</para>
0301 
0302 <para>The use of the password keeping feature is a tradeoff between
0303 security and comfort. I encourage you to think it over and decide for
0304 yourself if you want to use it or not.</para>
0305 
0306 </sect1>
0307 </chapter>
0308 
0309 <chapter id="Author">
0310 <title>Author</title>
0311 
0312 <para>&kdesu;</para>
0313 
0314 <para>Copyright 2000 &Geert.Jansen;</para>
0315 
0316 <para>&kdesu; is written by &Geert.Jansen;. It is somewhat based on
0317 Pietro Iglio's &kdesu;, version 0.3. Pietro and I agreed that I will
0318 maintain this program in the future.</para>
0319 
0320 <para>The author can be reached through email at &Geert.Jansen.mail;.
0321 Please report any bugs you find to me so that I can fix them. If you
0322 have a suggestion, feel free to contact me.</para>
0323 
0324 <!-- TRANS:CREDIT_FOR_TRANSLATORS -->
0325 
0326 &underFDL;
0327 &underArtisticLicense;
0328 
0329 </chapter>
0330 
0331 </book>
0332 <!--
0333 Local Variables:
0334 mode: sgml
0335 sgml-omittag: nil
0336 sgml-shorttag: t
0337 End:
0338 -->
0339