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.
1 Answer
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.
-
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– otisCommented Dec 18, 2012 at 22:59
-
1You 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. Commented Dec 18, 2012 at 23:07
-
1@ToDo: I believe you meant “In a terminal type
echo $PATH
.” Commented Dec 18, 2012 at 23:52
rwx
bits if youls -l
these binaries?/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
bin
directory (/home/otis/bin
) with the namesls
,cp
, etc…? (2½) Why? (2⅔) What are they? (3) Do shell built-in commands likecd
,echo
, andset
still work? (4) What is yourPATH
environment variable set to? (Either typeecho $PATH
or typeset
and look for a line beginningPATH=
.) (4½) Why?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.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.