Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Suddenly, when your Seniors Linux Server admin does not come at office. And Then Junior Linux Admin take a charge of it, then it is NIGHTMARE for them. Please help.

I'm not able to recollect, that what I did in .bashrc file in the server, after re-logging in the server. Not a Single was not working. Commands like ls, cat, and vi was not working on the server. I was Getting Error: "Command not found".

I have manage to fix from below steps:

  1. Edited .bashrc file in home pasted below text in the file

    PATH=$PATH:/home/amol/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games

    export PATH

  2. After reloading .bashrc from command --> source ~/.bashrc. Comands started working.

But whenever I loggin in the server. I get below error:

Last login: Tue May 14 10:33:46 2013 from 14.140.90.22
/usr/bin/env: bash: Permission denied
/usr/bin/env: bash: Permission denied
/usr/bin/env: bash: Permission denied
/usr/bin/env: bash: Permission denied
/usr/bin/env: bash: Permission denied
-bash: tar: command not found
-bash: grep: command not found
-bash: cat: command not found

I have searched in Google, but not getting exact solution.

OS: Ubuntu 10.04.

Below is .bashrc file: http://paste.ubuntu.com/5664287/

Please Help.

share|improve this question
    
As what user do you connect to the server? Whose .bashrc have you edited? –  choroba May 14 '13 at 12:25
    
Usually "Permission denied" happens when you don't have access to something, in this case probably the file /usr/bin/env. I suggest you try running that as root and see what happens. –  Radu Rădeanu May 14 '13 at 12:43
1  
The problem is more likely in ~/.bash_profile or ~/.profile (whichever happens to exist). PATH should not be set in ~/.bashrc, it should be set in one of those profile files, and they should in turn source ~/.bashrc. See mywiki.wooledge.org/DotFiles –  geirha May 14 '13 at 19:55
add comment

2 Answers 2

I found these in penguinparens.blogspot.com:

The partition your script lives on may be mounted with the "user" option set. "user" implies "noexec" (see the manpage for "mount"), which is going to keep you from running executables. And while running a binary executable from this kind of partition fails more clearly, trying to run a script with a shebang gives you this more confusing error message.

To fix! Add "exec" after your "user" flag in /etc/fstab. (again, see "man mount").

share|improve this answer
add comment

With this much fudge, I'd strongly consider starting a new bashrc. Even without a correct $PATH, the following should work:

/bin/mv ~/.bashrc{,.BAK}
/bin/cp /etc/skel/.bashrc ~

Of course, depending on how messed up things are, you might need to replace ~ with the path to your home. Try it and see.

You'll need to run /usr/bin/reset which should reload your bash session. Otherwise, start a new one.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.