You are not logged in.

1

Wednesday, June 4th 2003, 9:27pm

problems with su and kdesu

I have run RH7.2 for a few years and I prefer KDE desktop to gnome - I am using kde 2.2.1.
The system works fine logged in as ordinary user (greg), and logged in as root works fine also.
But using su or kdesu as greg does not work.

For example adsl works fine as root. Lately I have tried to run adsl by opening a new terminal and using the su (and kdesu) commands to work the various adsl comands (adsl-start, adsl-stop etc) of the rp - pppoe software.
Here is what happens with the command adsl-start (which works for root):
[greg@localhost greg]$ su
Password: (I enter root pw)
[root@localhost greg]# adsl-start
bash: adsl-start: command not found
[root@localhost greg]# cd /root
[root@localhost /root]# adsl-start
bash: adsl-start: command not found
[root@localhost /root]# cd /usr/sbin
[root@localhost sbin]# adsl-start
bash: adsl-start: command not found
[root@localhost sbin]# ./adsl-start
.. Connected!

When connected, adsl works properly. Only when I am in /usr/sbin and use the form of command ./adsl-start does it work.

when I try kdesu
[greg@localhost greg]$ kdesu adsl-start
(I enter the root password)
Session terminated, killing shell...
...killed.
(message "incorrect password, pls try again" - NB pw was correct)

[greg@localhost greg]$ kdesu ./adsl-start

Session terminated, killing shell...
...killed.
same message
[greg@localhost sbin]$ kdesu ./adsl-start gives same result (incorrect pw).

I tried "kdesu konquerer" and exactly the same thing happens, so the kdesu problem is not specific to adsl.

Ideally I would like to start adsl as non-root, but I would settle happily to have su or kdesu work normally to operate adsl-start.

any suggestions much appreciated ....

dimitri

Trainee

Posts: 156

Occupation: Engineer

  • Send private message

2

Wednesday, June 4th 2003, 10:13pm

Hi,
it seems that your $PATH Variable is not set correct.
type $PATH as root in the shell and look if /usr/sbin is init.
If not add it at /etc/profile.
To run adls-start as User you can use sudo. (I only know a german tutorial, so you will have to google a little)

Dim

3

Thursday, June 5th 2003, 2:56pm

You can get round this problem by typing...

su -l or su -

at the prompt.

This make the shell a login shell which imports root's $PATH which should have /usr/sbin in it

:)

4

Thursday, June 5th 2003, 3:47pm

if you want to use kdesu you must supply the full path:

#kdesu /usr/sbin/adsl

I suppose you are not connected to the modem (laptop?) all the time so you do not want to connect automatically every time you boot up?

5

Thursday, June 5th 2003, 6:29pm

I did $PATH

[root@localhost /root]# $PATH
bash: /usr/local/sbin:/usr/sbin:/sbin:/usr/kerberos/sbin:/usr/kerberos/bin:/sbin
:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin:/usr/local/bin:/root/bin: No such file o
r directory

I thought maybe the error message showed an obvious problem. In
the /root/.bash_profile shown below, there is an apparent error $HOME/bin. I removed this entry, but afterwards I logged out, and root could not log in as usual. I could start kde normally as greg, and I tried to reinstate the line in bash-profile exactly as I remembered it, but still root does not start - after about 10 secs, the blue login screen resets. As ordinary user, if I use su +root pw, I can edit files in /etc, /root etc.

I seem to have dug myself into a bigger hole - any help appreciated.



1. the file /etc/profile shows
/etc/profile

# System wide environment and startup programs
# Functions and aliases go in /etc/bashrc

if ! echo $PATH | /bin/grep -q "/usr/X11R6/bin" ; then
PATH="$PATH:/usr/X11R6/bin"
fi

ulimit -S -c 1000000 > /dev/null 2>&1
if [ `id -gn` = `id -un` -a `id -u` -gt 14 ]; then
umask 002
else
umask 022
fi

USER=`id -un`
LOGNAME=$USER
MAIL="/var/spool/mail/$USER"

HOSTNAME=`/bin/hostname`
HISTSIZE=1000

if [ -z "$INPUTRC" -a ! -f "$HOME/.inputrc" ]; then
INPUTRC=/etc/inputrc
fi

export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE INPUTRC

for i in /etc/profile.d/*.sh ; do
if [ -x $i ]; then
. $i
fi
done

unset i

2. the /etc/bashrc shows
# /etc/bashrc

# System wide functions and aliases
# Environment stuff goes in /etc/profile

# are we an interactive shell?
if [ "$PS1" ]; then
if [ -x /usr/bin/tput ]; then
if [ "x`tput kbs`" != "x" ]; then # We can't do this with "dumb" terminal
stty erase `tput kbs`
elif [ -x /usr/bin/wc ]; then
if [ "`tput kbs|wc -c `" -gt 0 ]; then # We can't do this with "dumb" terminal
stty erase `tput kbs`
fi
fi
fi
case $TERM in
xterm*)
PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD}\007"'
;;
*)
;;
esac
[ "$PS1" = "\\s-\\v\\\$ " ] && PS1="[\u@\h \W]\\$ "

if [ "x$SHLVL" != "x1" ]; then # We're not a login shell
for i in /etc/profile.d/*.sh; do
if [ -x $i ]; then
. $i
fi
done
fi
fi

3. the /root/.bash_profile shows
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi

# User specific environment and startup programs

PATH=/usr/local/sbin:/usr/sbin:/sbin:$HOME/bin
BASH_ENV=$HOME/.bashrc
USERNAME="root"

export USERNAME BASH_ENV PATH

6

Thursday, June 5th 2003, 7:22pm

:) Forget my last post and panic - I checked the .bash_profile file on another linux pc, and I restored the line I altered exactly
.../sbin:$PATH:$HOME:/bin

and then when I logged out I was able to come back in as root in the normal manner.

The above points by members are much appreciated.

when I do (as root) $PATH, I get this mess:

bash: /usr/local/sbin:/usr/sbin:/sbin:/usr/kerberos/sbin:/usr/kerberos/bin:/sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin:/usr/local/bin:/root/bin: No such file or directory

it must be relevant as to why kde and su commands as ordinary user are not working correctly

7

Saturday, June 7th 2003, 6:43am

:D when I use su -l, the problem is solved. Help is much appreciated