As I posted a little over two years ago, there
is an option to use
sudo with
kdesu to avoid having to type the root password.
It is worth noting that the same approach works for KDE4's
kdesu too.
Here is how to do it for KDE3:
/opt/kde3/bin/kwriteconfig -–file kdesurc -–group super-user-command -–key super-user-command sudo
And here for KDE4:
/usr/bin/kwriteconfig -–file kdesurc -–group super-user-command -–key super-user-command sudo
(make sure to use the fully qualified path to
kwriteconfig in both cases, just to make sure it works: the former in
/opt/kde3/bin is for KDE3 and the latter in
/usr/bin is for KDE4.. err.. yeah, that was obvious
:)).
Now here is a trick to be able to use
sudo for X applications directly, without going through
kdesu.
First of all, edit
/etc/sudoers (which one should always do using the command
visudo as it validates the configuration before saving it) and allow the environment variables
DISPLAY and
XAUTHORITY to be forwarded when using
sudo, by adding the following line:
Defaults env_keep += "DISPLAY XAUTHORITY"
The second step is to set and export the environment variable XAUTHORITY. The simplest option is to add the following line to your
~/.bashrc or add it to
/etc/bash.bashrc.local, the latter being for all users on your host:
[ -n "$DISPLAY" -a -e "$HOME/.Xauthority" ] && export XAUTHORITY="$HOME/.Xauthority"
There you go. Log out and log in again. Then simply do this, as an example:
sudo /sbin/yast2