LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Logging in as root get "/bin/bash: Permission denied" (https://www.linuxquestions.org/questions/linux-software-2/logging-in-as-root-get-bin-bash-permission-denied-648009/)

MikeyCarter 06-09-2008 08:04 AM

Logging in as root get "/bin/bash: Permission denied"
 
root@172.29.0.21's password:
Last login: Sun Jun 8 23:28:06 2008
/bin/bash: Permission denied
Connection to 172.29.0.21 closed.


I tried ssh, and direct console same results.

All the permissions look ok... not to mention I'm logging in as root. Doesn't root have full access to everything?


I can access the file system by mounting it and chroot to the mount. Any ideas what it's looking for?

shawnbishop 06-09-2008 08:20 AM

This could be a number of reasons,..

1. home folder deleted
2. wrong password

...

I would suggest booting into single user mode and checking what is causing the error

MikeyCarter 06-09-2008 08:44 AM

Quote:

Originally Posted by shawnbishop (Post 3179234)
This could be a number of reasons,..

1. home folder deleted
2. wrong password

...

I would suggest booting into single user mode and checking what is causing the error


According to the /var/log/secure it's logging in fine. The /root folder exists with 750 and the password I did an passwd to change it. So it's definitely not that.

Went to single user mode and I'm sitting at a sh-3.1# prompt.

What do I check from here? Any other suggestions?

ischi 06-09-2008 09:10 AM

Is Root Login Via SSH enabled? There is an option to disable root Login via SSH so if this is set the root login fails and you can only login as normal user and then su to root.

/etc/ssh/sshd_config and set "PermitRootLogin" to "yes".

forrestt 06-09-2008 09:13 AM

What does 'ls -l /bin/bash' output?

Forrest

MikeyCarter 06-09-2008 09:28 AM

Quote:

Originally Posted by ischi (Post 3179283)
Is Root Login Via SSH enabled? There is an option to disable root Login via SSH so if this is set the root login fails and you can only login as normal user and then su to root.

/etc/ssh/sshd_config and set "PermitRootLogin" to "yes".



Enabled or not it wouldn't explain why I can't even log in on the console.

ls -l /bin/bash

-rwxr-xr-x 1 root root 722684 Jan 5 2007 /bin/bash

forrestt 06-09-2008 09:43 AM

OK, it might be your .login, .profile, or .bashrc file is having an error. Try moving the root home directory out of the way and creating a new one that is empty and see if you can log in.

HTH

Forrest

MikeyCarter 06-09-2008 09:52 AM

Quote:

Originally Posted by forrestt (Post 3179326)
OK, it might be your .login, .profile, or .bashrc file is having an error. Try moving the root home directory out of the way and creating a new one that is empty and see if you can log in.

HTH

Forrest

Still no luck. Did:

mv root root-bk
mkdir root


still same problem.

colucix 06-09-2008 10:13 AM

You can check also the libraries on which the /bin/bash executable depends:
Code:

ldd /bin/bash
to retrieve a list of required libraries, then check if they are still in place.

MikeyCarter 06-09-2008 10:19 AM

Quote:

Originally Posted by colucix (Post 3179354)
You can check also the libraries on which the /bin/bash executable depends:
Code:

ldd /bin/bash
to retrieve a list of required libraries, then check if they are still in place.

did ldd.

Checked all the libraries listed and all they're symbolic links. Permissions are either 0755 or 0777

MikeyCarter 06-09-2008 10:30 AM

Stop looking I found it ;)
 
found it. Booting the kernel with selinux=0 solved my problem.



I always forget about that stupid selinux. Most times programs say denied by firewall. selinux tends to just silently block things... (where's the beading my head against a wall emoticon... )

One of these days I'll remember to check it first. *ARRRRR!*

Thanks for all the quick responses...

forrestt 06-09-2008 10:40 AM

OK, then perhaps it is a permission with one of the libraries that bash is calling. The command 'ldd /bin/bash' will tell you which libraries it is using. Some of them are links that point to other links, but eventually they all point to a real file. Look at the permissions of the real files. On my system they are all 755 root:root.

Note: The file linux-gate.so isn't really a file, it is a virtual dynamically shared object (DSO) that is part of the kernel.

HTH

Forrest

forrestt 06-09-2008 10:44 AM

I guess I shouldn't hit submit on a post I was working on 45 minutes ago but had to put off due to working on other things without refreshing it to see if someone else already answered the question. :p

Oh well, at least you figured it out.

Forrest

dayeliu 07-24-2014 11:46 AM

selinux?
 
@MikeyCarter, did you figure out what exact triggered SELINUX? I know this was a six years old post, but I am seeing exact same symptom on Fedora 20 after an update.

Thanks.

MikeyCarter 07-24-2014 11:55 AM

Quote:

Originally Posted by dayeliu (Post 5208983)
@MikeyCarter, did you figure out what exact triggered SELINUX? I know this was a six years old post, but I am seeing exact same symptom on Fedora 20 after an update.

Thanks.

Never bothered to look any further into it.


All times are GMT -5. The time now is 11:22 AM.