Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I'm trying to build a LFS using version 7.1. I've followed all of the steps up to 5.3 and now I'm stuck because I can't change to $LFS/sources - I get the message:

bash: cd: /mnt/lfs/sources: Permission denied

I'm logged in, in a new terminal, as lfs. The directory permissions (as seen from /mnt/lfs by root) are:

drwx------ 6 leo  leo   4096 May 26 18:02 .
drwxr-xr-x 3 root root  4096 May 21 20:43 ..
drwx------ 2 root root 16384 May 21 20:24 lost+found
drwxr-xr-x 2 leo  leo   4096 May 26 18:00 patches
drwxrwxrwt 2 lfs  root  4096 May 26 17:53 sources
drwxr-xr-x 2 lfs  root  4096 May 26 18:02 tools

The mount spec for the partition is:

/dev/sdb3 on /mnt/lfs type ext3 (rw)

I'm far from new to UNIX and LINUX and this is really annoying me. I know it's something blindingly obvious but I just can't see it.

I have restarted the machine, sourced the lfs profile (source ~/.bash_profile) but just can't seem to find the one thing I'm missing. The host system is Debian if that helps.

share|improve this question
    
What is the output of ls -ld /mnt/ and ls -ld / –  Ulrich Dangel May 26 '12 at 19:56
    
'drwxr-xr-x 3 root root 4096 May 21 20:43 /mnt/' and 'drwxr-xr-x 23 root root 4096 May 26 18:02 /' –  Leo May 27 '12 at 1:10
1  
I don't know LFS but it seems it is using a dedicated user for building the software and /mnt/lfs has some pretty restrictive permissions. chmod 755 /mnt/lfs should probably solve your issue –  Ulrich Dangel May 27 '12 at 1:18

3 Answers 3

You /mnt/lfs directory is restricted to user leo (mode 0700), no-one else can enter it.

Change that to 755 (chmod go+rx /mnt/lfs) and things should work out.

share|improve this answer

I tried those suggestions but to no avail. I recalled that I created the user lfs, then deleted it and recreated it after assigning owner permissions. So I completely deleted it (and associated files) again, reassigned ownership to root and went through the whole process again.

Still, I couldn't change into /mnt/lfs/sources or /mnt/lfs/tools. So I tried changing /mnt/lfs to 755 again and it all worked. Weird - I should be able to enter a child directory to which I have granted access even though I don't have access to the parent.

share|improve this answer
2  
"I should be able to enter a child directory to which I have granted access even though I don't have access to the parent." No, you shouldn't. You need x permissions from / to the final directory. –  Mat May 27 '12 at 10:31
    
Surely that would imply that any user could change to any higher up directory in the filesystem. –  Leo May 28 '12 at 13:44
    
See chdir in POSIX: "EACCESS Search permission is denied for any component of the pathname." - note that the check is done at the time of call. You could change permissions on a path component afterwards (which would very likely have strange effects on unsuspecting processes). –  Mat May 28 '12 at 13:52

Run the following commands

root@host--$: chmod 777 -R /mnt/lfs
root@host--$: chmod 777 -R /mnt/lfs/sources
root@host--$: chmod 777 -R /mnt/lfs/tools

It will solve your issue.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.