LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux From Scratch (https://www.linuxquestions.org/questions/linux-from-scratch-13/)
-   -   cannot execute /bin/bash: Permission Denied (https://www.linuxquestions.org/questions/linux-from-scratch-13/cannot-execute-bin-bash-permission-denied-33216/)

peeples 10-19-2002 08:54 AM

cannot execute /bin/bash: Permission Denied
 
I'm probably gonna feel like a real noob when someone tells me how to fix this, but, here goes...

I've had LFS up and running for a week now. Been snooping around and looking at how the system is set up. Decided to actually start using it, so I figured I'd better set up a user account. Well, after I got it set up, Tried to login with it. Got the "cannot execute /bin/sh: Permission Denied" thing. Well I checked permissions on both the /bin/sh link (777) and /bin/bash (755). So I said to myself, why is it using sh? Looked in the passwd file, found that and changed it to /bin/bash. Checked for a /home/peeples directory, it wasn't there, so I added it via root account and chown peeples: peeples. Since it was a new directory it was empty, so I copied .bash* from my base distro into this new directory. Tried to login with user again, got "cannot execute /bin/bash: Permission Denied". Since it changed from /bin/sh to bin/bash, I now know that it's reading the passwd file correctly. I double-checked ownership of my home directory, everything is correct. When I looked in /bin everything is root:root, all links are 777, and all other files are 755, that's right, isn't it? How can I get my user account running?

TIA

lfslinux 10-19-2002 10:06 AM

Check the permissions on the / directory. If it's not set to something like 755 the normal users aren't able to get to their home directories or any other directories, no matter if /bin itself has proper permissions. / is the first directory accessed and it needs to be 755 too.

So run ls -ld / and see what it reports and fix accordingly if something is out of the ordinary.

peeples 10-19-2002 02:23 PM

Permissions on / are correct at 755. Anything else to check?

lfslinux 10-19-2002 02:50 PM

How about the /home directory itself?

peeples 10-19-2002 07:33 PM

/home is owned by root:root (755). What next?

BTW, the permissions and ownership don't change, right? Because instead of rebooting into my LFS to check this stuff, I've just mounted the partition under /lfs in my base distro. Then I just cd to the parent directory and type ls -la. If I have to reboot it's no problem, I just don't want to waste your time if I'm giving you wrong answers...

Thanks.

lfslinux 10-19-2002 07:54 PM

It might be a factor, depending on how your partitions are mounted according to the $LFS/etc/fstab file

Best is to actually boot into LFS and give the outputs of these commands:

ls -ld / /home /home/youruser

It should give output similar to this:

gerard@lorien:~$ ls -ld / /home /home/gerard
drwxr-xr-x 16 root root 360 Oct 15 12:36 /
drwxr-xr-x 9 root root 192 Oct 16 15:03 /home
drwxr-x--- 55 gerard gerard 4016 Oct 19 18:19 /home/gerard

peeples 10-19-2002 09:16 PM

Ok, I booted into lfs. Logged in as root. then typed:

ls -ld / /home /home/peeples > test

This is what was in the test file:

drwxr-xr-x 19 root root 4096 Oct 19 14:45 /
drwxr-xr-x 3 root root 4096 Oct 19 08:12 /home
drwxr-xr-x 2 peeples peeples 4096 Oct 19 14:49 /home/peeples

lfslinux 10-19-2002 09:53 PM

Uhmmm /me scratches his head
Why are we checking the /home/peeples directory again when the error shows /bin/bash Permission Denied

Run this ls -ld /bin

Does it have a mode of 755 too?

peeples 10-20-2002 09:43 AM

Booted back into LFS.

ls -ld /bin gives root:root at 755

Went into /etc/passwd again. This is its contents:

root:U/7pZokqZN8v6:0:0:root:/root:/bin/bash
peeples:Dn8YWXGhsP/2o:506:506:peeples:/home/peeples:/bin/bash

(except change the smilies back to their text equivilents)


Also looked in /etc/group. This is its contents:

root:x:0:
bin:x:1:
sys:x:2:
kmem:x:3:
tty:x:4:
tape:x:5:
daemon:x:6:
floppy:x:7:
disk:x:8:
lp:x:9:
dialout:x:10:
audio:x:11:
peeples:x:506:


What next?

peeples 10-21-2002 08:20 PM

Still having this problem. Cannot find answers on IRC. Please help...

lfslinux 10-21-2002 08:49 PM

Boot LFS run "/bin/mount" and show the line that represents your root partition.

peeples 10-22-2002 05:41 PM

The results of /bin/mount are as follows:

rootfs on / type rootfs (rw)
/dev/root on / type ext2 (rw)
proc on /proc type proc (rw)
/dev/hda2 on /redhat type ext3 (rw)

denny

lfslinux 10-22-2002 06:19 PM

I admit, I've no idea. The mount options are right and the permission on all paths involved are right too.

Can you login as root?

If so, login as root, then sun this: "su - peeples"

make sure you type that - as it means that the session will be a login session.

Do you get errors?

peeples 10-22-2002 07:17 PM

Rebooted to LFS. Logged in as root. Typed "su - peeples" and got:

No mail.
cannot execute /bin/bash: Permission Denied

and it kicked me back to login: prompt. I logged back in as root, added a new user peeps, made a password for that account, and made a home directory owned by peeps at 755. Tried logging in with that account and recieved:

Last login at blah, blah, blah
No mail.
cannot execute /bin/bash: Permission Denied

That was on the first login with peeps account. I don't know where it came up with a prior login time.

So, the only account that works is root.

Denny

MasterC 10-23-2002 01:46 PM

Have you tried changing your entry in /etc/passwd for any given user from /bin/bash to /bin/sh just to see if you get another response, or any other shell?

Just trying to toss out suggestions as well

Cool


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