[SOLVED] Getting permission denied when running "sudo bash"
Red HatThis forum is for the discussion of Red Hat Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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?
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.
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
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.