Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I don't know what I did but suddenly i can't use any commands except and only preceded with sudo. No matter the command I get bash: /home/otis/bin/ls: cannot execute binary file. Even cp I get bash: /home/otis/bin/cp: cannot execute binary file. if I put sudo before all is well. How do I correct this so every single command does not have to be done as superuser.

share|improve this question
What do you see in the rwx bits if you ls -l these binaries? – Nicole Hamilton Dec 18 '12 at 22:40
Unless you have a good reason for having system binaries in your home directory, it looks like you messed up your PATH. It should look something like /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games – user55325 Dec 18 '12 at 22:53
So many questions to ask. (1) Have you tried logging out and logging in again? (2) Do you really have files in your private bin directory (/home/otis/bin) with the names ls, cp, etc…? (2½) Why? (2⅔) What are they? (3) Do shell built-in commands like cd, echo, and set still work? (4) What is your PATH environment variable set to? (Either type echo $PATH or type set and look for a line beginning PATH=.) (4½) Why? – Scott Dec 18 '12 at 22:54
Otis, just to re-iterate what has been said, if you haven't created a bin folder in your home directory and populated it with these binaries, and modified your path, then something has gone seriously wrong. One of the possibilities is that your system has been compromised. If you haven't done these things yourself, then stop trying to fix things and let us help investigate - you may be trying to run binaries that were put there maliciously. – Paul Dec 18 '12 at 23:03
Can you try sudo mv /home/otis/bin /home/otis/bin.old. This will rename the directory, which will then allow the proper binaries in /bin to execute. – Paul Dec 19 '12 at 2:52

There's something wrong in your path. It works with sudo because it uses root settings.

Did you modify your $PATH environment variable?

In a terminal type $PATH. You should get something like: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

I guess that yours would /usr/local/sbin:/home/otis/bin:/usr/sbin:/usr/bin:/sbin:/bin or something like that.

To solve this issue try typing: PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

Hope this helps.

share|improve this answer
Okay with $PATH this is what I got bash: /home/otis/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/usr/lib‌​/jvm/jdk1.7.0/bin: No such file or directory – otis Dec 18 '12 at 22:59
You can fix this temporarily by following the instructions above, but you need to figure out why this is happening. I would look in .bashrc and .bash_profile first. – user55325 Dec 18 '12 at 23:07
@ToDo: I believe you meant “In a terminal type echo $PATH.” – Scott Dec 18 '12 at 23:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .