LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices



Reply
 
Search this Thread
Old 08-08-2006, 10:46 AM   #1
flipwhy
Member
 
Registered: Jul 2006
Posts: 102

Rep: Reputation: 15
cannot execute bash: permission denied


hi...i get the above error when i try to login as root...which as you can imagine is really not very good!!
my .bash_profile is also not the same..it almost has nothing in it...about 3 lines..thats it.
ive chmod 755 for the .bash_profile and .bashrc files...and checked lib and bin and they r all ok... even the /bin/bash has 755 mode.
any ideas?
 
Old 08-08-2006, 11:00 AM   #2
Agrouf
Senior Member
 
Registered: Sep 2005
Location: France
Distribution: LFS
Posts: 1,591

Rep: Reputation: 79
the $PATH is probably bad. Try setting it correctly in .bashrc
 
Old 08-08-2006, 12:10 PM   #3
flipwhy
Member
 
Registered: Jul 2006
Posts: 102

Original Poster
Rep: Reputation: 15
ok..i'm not sure exactly how to..
i checked PATH with echo...and it gave a long line of /sr/bin:/usr/sbin ...
within .bashrc..i dont know if there is a PATH..
could you gimme some more details.
 
Old 08-08-2006, 12:51 PM   #4
anamericanjoe
Member
 
Registered: May 2006
Posts: 69

Rep: Reputation: 16
As a normal user, try to determine where the binary is for bash with

Code:
which bash
That command will return the path to the version of bash that you use as a normal user.

Then, as root

Code:
echo $PATH
Check to see if this path includes the path to bash you found earlier. If it doesn't, your root's path is bad and you should add the path to your bash binary to your path.
 
Old 08-08-2006, 01:03 PM   #5
nx5000
Senior Member
 
Registered: Sep 2005
Location: Out
Posts: 3,307

Rep: Reputation: 53
Quote:
Originally Posted by Agrouf
the $PATH is probably bad. Try setting it correctly in .bashrc
I think the path should be set in /etc/profile or maybe in .bash_profile but not in .bashrc.

(bashrc is not read on login shells)
Quote:
if [ "`id -u`" -eq 0 ]; then
PATH="/root/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
else
PATH="/usr/local/bin:/usr/bin:/bin:/usr/games"
fi

Last edited by nx5000; 08-08-2006 at 01:04 PM.
 
Old 08-08-2006, 01:05 PM   #6
Agrouf
Senior Member
 
Registered: Sep 2005
Location: France
Distribution: LFS
Posts: 1,591

Rep: Reputation: 79
^
|

that is true.
 
Old 08-08-2006, 02:00 PM   #7
flipwhy
Member
 
Registered: Jul 2006
Posts: 102

Original Poster
Rep: Reputation: 15
i tried that..
when i put which bash...it said /bin/bash
so i added /bin: to the front of my PATH in the etc/profile file as well as the .bash_profile file.
Still not being allowed.
 
Old 08-08-2006, 02:14 PM   #8
anamericanjoe
Member
 
Registered: May 2006
Posts: 69

Rep: Reputation: 16
Have you checked the permissions on /bin/bash?

Try this:

Code:
ls -lag /bin/bash
Please post the result of this command.
 
Old 08-08-2006, 02:16 PM   #9
flipwhy
Member
 
Registered: Jul 2006
Posts: 102

Original Poster
Rep: Reputation: 15
ya...ive chmoded just about everything to 755
 
Old 08-08-2006, 02:57 PM   #10
anamericanjoe
Member
 
Registered: May 2006
Posts: 69

Rep: Reputation: 16
This may not fix your current problem, but you probably don't want a binary to be writable by anyone, not even root, since that allows the binary to become corrupt.

You'd probably be better off changing the permissions of /bin/bash to 555.

Also, what are the permissions on /bin, the directory?

Try

Code:
ls -ld /bin
 
Old 08-08-2006, 04:25 PM   #11
flipwhy
Member
 
Registered: Jul 2006
Posts: 102

Original Poster
Rep: Reputation: 15
yeah...theyre all executable by all and readable by all...
i think i just overly messed up..playing too much in root..
think ill just re-install.
thanks for you help. good stuff
 
Old 11-12-2007, 11:49 AM   #12
cuco76
Member
 
Registered: Oct 2003
Location: Tucson
Distribution: Fedora, RHEL 5
Posts: 220

Rep: Reputation: 31
Had this same exact issue. Turns out the /etc dir was 700 so chmod to 755 and everything was fine.

Hope this helps someone out!

Chris
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
can't execute c++ binaries, "permission denied"... even though permission is 777 SerfurJ Programming 14 02-20-2009 05:50 AM
Permission denied to execute anything under /home ErrorBound Linux - Software 8 07-26-2006 10:21 AM
Problem Cannot execute /bin/bash: Permission denied xeo Linux - Software 2 10-13-2004 11:55 PM
Cannot execute /bin/bash: Permission denied Hegemon Linux - General 4 01-19-2004 05:13 AM
cannot execute /bin/bash: Permission Denied peeples Linux From Scratch 24 10-25-2002 09:07 AM


All times are GMT -5. The time now is 06:43 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration