LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Strange root behaviour (http://www.linuxquestions.org/questions/linux-newbie-8/strange-root-behaviour-378728/)

wardjame 10-31-2005 04:31 PM

Strange root behaviour
 
Hi All,
I recently got a copy of Fedora Core 4 running LAMP with SSL thanks to the wonderful tutorial at linuxhowto.

Things were going fine until recently. For some reason my root user is behaving a little differently. I first noticed the problem when I tried to use the shutdown command as root and it came back with command not found.

I noticed another oddity when I attempted to start proftpd, I navigated to /usr/local/sbin and type proftpd and also got command not found. ls showed that proftpd was clearly in the current directory.

The final oddity came when I typed pro and hit tab to try to let it autocomplete to make sure a typo was not to blame. The results where as follows:
procmail profiles proftpd protoize prove

Pressing tab used to just autocomplet the current directory, all the files other than proftpd exist elsewhere on my system.

Runing proftpd seems to work fine now but the tab oddness continues. I assume I did something to change the way the shell is behaving. Any thoughts on what I may have done and how I could undo it?

Thanks in advance.

Linux.tar.gz 10-31-2005 05:39 PM

I tried many Linux distros and i always found strange issues. Then i installed Slackware.

JimBass 10-31-2005 06:01 PM

You are making errors in bash usage. If the location of the proftp binary is /usr/local/sbin/proftpd, you can't cd to /usr/local/sbin and then manually run proftpd by typing proftpd. You need to preface it with ./ So if you are in /usr/local/sbin/ the command to launch proftpd from there is
Code:

./proftpd
From anywhere else, all you need is the full patch, but launching executable files from the directory they are contained in requires the ./ before the file name.

The tab problem is that tab can only autocomplete for you to a non-unique digit. You say you have

Quote:

procmail profiles proftpd protoize prove
all in the same directory, How is tab supposed to know with only pro typed in wether you want procmail or proftpd? You have to get to unique digits. If you typed prof then hit tab, the shell would see that it can't be procmail, profiles,protoize, or prove, and it would fill in the rest of the proftpd command for you.

Peace,
JimBass

jschiwal 10-31-2005 06:49 PM

You may want to check the PATH for root. It looks like /usr/local/sbin is not in the path.

wardjame 11-01-2005 03:33 PM

Quote:

Originally posted by JimBass
The tab problem is that tab can only autocomplete for you to a non-unique digit. You say you have

all in the same directory, How is tab supposed to know with only pro typed in wether you want procmail or proftpd? You have to get to unique digits. If you typed prof then hit tab, the shell would see that it can't be procmail, profiles,protoize, or prove, and it would fill in the rest of the proftpd command for you.

Peace,
JimBass [/B]
Hi Jim,
Thanks for the info about using ./ before commands in the current directory. I should have realized that was my problem.

The tab thing is still a little odd though. I actually say specifically that they are NOT in the the same directory and that is what I find odd. I have never seen this behaviour before where tab autocompletes to files outside the current directory and I have to say I don't much like it. Any idea how to make it stop doing that? From the root dir "/" if I type pro and hit tab I get the exact same list.

jschiwal 11-10-2005 06:03 AM

There are different types of autocompletion, depending on the context of what you are doing. If you type in "pro[tab]" for example, you will get a list of commands that start with "pro". If you type "./pro", then only commands in your current directory will be listed. If you type "ls pro[tab]", then files beginning with "pro" in the current directory are listed. There may be package on your system that adds even more context and capabilities. Such as arguments to "modprobe". Suppose you need to load in the "ehci-usb" module but only remember the first 2 letters. Entering "modprobe eh[tab]" will help you find it.

ethics 11-10-2005 07:32 AM

Quote:

Originally posted by wardjame
Hi Jim,
Thanks for the info about using ./ before commands in the current directory. I should have realized that was my problem.

The tab thing is still a little odd though. I actually say specifically that they are NOT in the the same directory and that is what I find odd. I have never seen this behaviour before where tab autocompletes to files outside the current directory and I have to say I don't much like it. Any idea how to make it stop doing that? From the root dir "/" if I type pro and hit tab I get the exact same list.

if you type pro [tab] it will autocomplete anything that meets those criteria from your PATH (a list of directories your system looks in for commands) echo $PATH will show yours (root normally has different paths to a user by default). AFAIK this has always been the default way in fedora.

if you type ./pro[tab] it will autocomplete in that directory.

wardjame 11-10-2005 09:25 AM

Thank you,
That was very helpful. After reading your post and a little experimenting I realized why things looked so different to me.

The bahaviour changed when I had finished setting up my box and added a normal user. When I "su" from that user the $PATH is not the same as it is when I was logging in as root during installation. Hence the bahaviour seemed different to me.

Thanks again for all the help.

James


All times are GMT -5. The time now is 02:19 AM.