Linux – Cannot execute basic linux commands (ps, ls, ifconfig) – File not found

filesystemslinuxUbuntu

I am running Ubuntu Linux, and am having some major system issues (networking not working, etc), which I think could be based on this fundamental problem.

When I try execute a variety of basic commands (including ps, ls, ifconfig, locate), I receive the error 'no such file or directory'.

Here are some suggestions that I've found online, that I have tried without success:

  1. I did a 'whereis ps' and found the file in the /bin/, and have checked that '/bin'
    appears when I do 'echo $PATH'
  2. I did a filesystem check which showed my hard drive as being clean
  3. I tried doing a 'sudo chmod 777 ps' but was told that I dont have permission. I don't think permissions for these files would have changed though (and I can't check as I can't run the 'ls' command).

Any help would be highly appreciated.

Best Answer

To cut a long story short, it looks like I was rooted by SHV4 / SHV5 rootkit. I will soon be formatted and reinstalling my box.

For future reference though, I was able to fix the file permissions by changing the file attributes (chattr -ais <filename>) and then changed the file owner back to root. The files were infected anyway though.

Thanks to all for you help and suggestions

Related Question