Showing posts with label sudo. Show all posts
Showing posts with label sudo. Show all posts

21/07/2008

OpenSuSE 11, kdesu and sudo ;-)

Hardly more than a quick comment to daWuzzzz's last post:
Note that in 11.0 they switched from sudo to su behind kdesu. Starting YaST or KControl, you will still be prompted for the root password, even if you are a sudoer. Ben Kevan's blog has some recipe for that.
E.g. for KDE3, edit ~/.kde/share/config/kdesurc (or create that file).
[Passwords]
Keep=false

[super-user-command]
super-user-command=sudo
For KDE4, take the ~/.kde4/... equivalent (did it only on KDE3 myself). Of course, you can also switch kdesu to su on openSuSE 10.3 with the same method.

OpenSuSE 11 and Sudo

Just to let you know again: in order to add a user to the sudoers, adding the user to the group "trusted" and configuring it in the Yast Module Sudo is NOT sufficient. What avocadohead has already pointed out in this article posted in this blog is valid as well for OpenSUSE 11, i.e. manually configuring the /etc/sudoers file and commenting out the lines indicated in the commented file.

15/11/2007

HowTo run KDE applications as root

If you get "foo: cannot connect to X server" when you try running KDE applications as su from the shell - don't worry, apparently this is a security feature, and not a bug. I remember being able to do so under openSUSE 10.2, but anyway... it can be fixed the following ways:

You can either use

> kdesu foo &

Or, before you become root, enter the following

> xhost +
> su
# foo &

If you now get the error "bash: foo: command not found", then you need to add /opt/kde3/bin to root's $PATH. First, check whether the file /root/.bashrc already exists. If not, create it. Then add the following line

export PATH=$PATH:/opt/kde3/bin

Then log out and back in - you need to log in after you modify the file for bash to find your new $PATH.

# exit
# su

and check whether the new directory is now in your $PATH

# echo $PATH

09/10/2007

Bash fun - sudo insults and locomotives

Don't you ever get the feeling that your computer is too nice? No? Never mind. Basically, this is just the howto for letting sudo use your user password instead of the root one.

If you haven't done that already, configure your user account for sudo in YaST:
1. Security and Users -> Group management: add your account to the "trusted" group
2. Security and Users -> Sudo: in the Add... dialogue, choose your account under "User" and the value ALL for all other input lines.

Regrettably, in the standard SuSE installation sudo still doesn't accept your password.
Edit the sudoers file:
sudo vi /etc/sudoers
Comment out the lines under "When configuring sudo, delete the two following lines:", should look like this:

# Defaults targetpw
# ALL ALL = (ALL) ALL
avocadohead ALL = (ALL) ALL

Oh, and if you add the line Defaults insults somewhere in the file, the shell gets really bitchy when you type the wrong password.
Reset your sudo session with sudo -K to try them out.

HowTo customise the insults list in theory (do this at your own risk and make sure you know the root password): Unlike many other linux packages, the insults list is hard-coded into the sudo executable (to prevent wanton discrimination and trollities, I suppose). Get the sources; various types of insults are listed in the ins_*.h files. Write your own ins_custom.h file and adapt all # include, # define and # ifdef statements in the respective source files. Configure (--with-all-insults), make and install. If you broke a previously untainted sudo with this, at least you ought to have some really fine insults ready by now. Apply them fittingly and try re-installing in YaST from a proper root shell.

A propos typos: On our old Linux cluster we had a gimmick for people typing sl instead of ls - the Ascii steam locomotive.
Download the source tarball and extract.
tar -xf sl.tar
cd sl

Switch compiler lines in the Makefile (move the comment sign to the line referencing libtermcap) and change the lcurses flag to lncurses:
# $(CC) $(CFLAGS) -o sl sl.c -lcurses -ltermcap
$(CC) $(CFLAGS) -o sl sl.c -lncurses

Compile with make, and copy sl where Linux can find it:
sudo cp sl /usr/bin/

Try the options sl -l and sl -a ...