LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat
User Name
Password
Red Hat This forum is for the discussion of Red Hat Linux.

Notices


Reply
  Search this Thread
Old 01-25-2012, 10:34 AM   #1
Clariollo
LQ Newbie
 
Registered: Jan 2012
Posts: 5

Rep: Reputation: Disabled
Getting permission denied when running "sudo bash"


Hello all,

I have a RHEL 5.6 system which is configured to use sudo, everything seems fine but when I run sudo bash as the example users (which is in the sudoers) I get :

sudo bash

bash: /bin/grep: Permission denied

bash: /bin/grep: Permission denied

bash: /usr/bin/id: Permission denied

bash: [: =: unary operator expected

bash: /sbin/consoletype: Permission denied

bash: /usr/bin/id: Permission denied



despite the error messages I "become" root but if I try to run any command I Get :

bash: /usr/bin/whoami: Permission denied

bash: /bin/ls: Permission denied


Similarly if I try, always as the example user, to run sudo su - I get :

su: /bin/bash: Permission denied


Only using su - works as intended and I can run everything as root.

I already check all obvious stuff like permissions on /bin, bash inizialitation files, sudoers etc. etc. everything is ok in that department yet I keep getting this.

I was not the person setting up the machine, which makes everything even more difficult, if possible, but for what I could gather no weird customization have been made to the system...

I'm really stuck, does anybody has any suggestion or trick to try?

Thanks in advance!
 
Old 01-25-2012, 10:45 AM   #2
ButterflyMelissa
Senior Member
 
Registered: Nov 2007
Location: Somewhere on my hard drive...
Distribution: Manjaro
Posts: 2,766
Blog Entries: 23

Rep: Reputation: 411Reputation: 411Reputation: 411Reputation: 411Reputation: 411
I gather you checked the permission on the bash file, but how about the stuff the bash file starts up? Do you have permissions on them as well?
 
Old 01-25-2012, 10:51 AM   #3
Clariollo
LQ Newbie
 
Registered: Jan 2012
Posts: 5

Original Poster
Rep: Reputation: Disabled
Hi Thor,

yup I've checked the /, /bin and even each of the binaries for which I get permission denied and of course the files that bash is sourcing (for what I can gather it's sht standard .bashrc without anythng peculiar), maybe I've missed something? The weird thng is if I run /bin/bash as root or as example user everything is initialized correctly without error messages.

On a side note out of deperation I even checked attributes for /bin/bash, su and sudo comparing with another running system, RHEL 5.3, and even in that department everything seems fine.

I think the problem is somehow bound to sudo/su as I get these errors only when trying to use these tools but honestly cannot see where or what can cause this.

Thanks!

Last edited by Clariollo; 01-25-2012 at 11:02 AM.
 
Old 01-25-2012, 11:16 AM   #4
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
What are the permissions and ownerships of /usr/bin/sudo?
 
Old 01-25-2012, 11:26 AM   #5
Clariollo
LQ Newbie
 
Registered: Jan 2012
Posts: 5

Original Poster
Rep: Reputation: Disabled
Angry

Quote:
Originally Posted by catkin View Post
What are the permissions and ownerships of /usr/bin/sudo?
They are ok for what I can recall on top of memory :

---s--x--x 2 root root 183392 Mar 5 2011 /usr/bin/sudo

Same story for the containing folder, all permissions are correct.
 
Old 01-25-2012, 11:33 AM   #6
Clariollo
LQ Newbie
 
Registered: Jan 2012
Posts: 5

Original Poster
Rep: Reputation: Disabled
Ok with some calm I've been finally to spot the bas... err the problem

In the sudoers configuration someone had implemented/activated the NOEXEC option as per sudoers manual :

Quote:
If sudo has been compiled with noexec support and the underlying operating system supports it, the NOEXEC tag can be used to prevent a dynamically-linked executable from running further commands itself.

In the following example, user aaron may run /usr/bin/more and /usr/bin/vi but shell escapes will be disabled.

aaron shanty = NOEXEC: /usr/bin/more, /usr/bin/vi

See the PREVENTING SHELL ESCAPES section below for more details on how NOEXEC works and whether or not it will work on your system.
Well I'm glad this is solved and that I finally decided to subscribe to the community, been a serial lurker for years

Thanks everybody for pointers and helping me solve this, even if indirectly
 
1 members found this post helpful.
Old 01-25-2012, 02:18 PM   #7
ButterflyMelissa
Senior Member
 
Registered: Nov 2007
Location: Somewhere on my hard drive...
Distribution: Manjaro
Posts: 2,766
Blog Entries: 23

Rep: Reputation: 411Reputation: 411Reputation: 411Reputation: 411Reputation: 411
and...thanks for sharing the solution
 
  


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
Logging in as root get "/bin/bash: Permission denied" MikeyCarter Linux - Software 19 10-25-2021 11:02 AM
"bash: /dev/null: Permission denied" on Ubuntu Login... sancho Ubuntu 10 10-07-2009 11:38 PM
accessing centos5.2 partition from ubuntu : "bash: cd: ckgan: Permission denied" centguy Linux - Software 5 02-24-2009 12:18 AM
"sudo mount -a" works perfect but permission denied when mounting on startup, why? aaron4katie Linux - Software 10 01-11-2007 10:16 AM
Eclipse SDK v3.0 running problem: "Permission denied" AlexDunnCpp Linux - Newbie 1 08-03-2004 11:45 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat

All times are GMT -5. The time now is 07:55 AM.

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
Open Source Consulting | Domain Registration