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.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top


I am working on a RHEL 5 cluster. I want my Fortran program to read the file /home/bob/inputs/input_1

  1. I asked Bob to give me permission to read all contents of inputs:

    [bob@server]$ chmod -R a+r /home/bob/inputs/*
  2. I linked these to a shared directory:

    [david@server]$ ln -s /home/bob/inputs/ /home/share/inputs/
  3. My (Fortran) program tried to read /home/share/inputs/input_1 and said:

    File /home/share/inputs/input_1 not found!
  4. I tried to locate the file myself (in the process, bob gave a+rwx permissions):

    [david@server]$ls -ltrh /home/share/inputs/input_1
    lrwxrwxrwx 1 bob bob 33 Oct 25 15:42 /home/share/inputs/input_1 -> /home/bob/inputs/input_1

    From this, I concluded that a) inputs_1 exists and b) all users have rwx permission.

  5. I tried to read it:

    [david@server]$ more /home/share/inputs/input_1 
    /home/share/inputs/input_1: No such file or directory

    And am told that it does not exist.

  6. I look for the target file /home/bob/inputs/input_1 but am denied permission.

    [david@server]$ls -ltrh /home/bob/inputs/input_1
    ls: /home/bob/inputs/input_1 Permission denied
  7. Something bizzare happens if I ls the directory contents:

    [david@server]$ls -ltrh /home/bob/inputs/
    ?--------- ? ? ? ?            ? input_1
    ?--------- ? ? ? ?            ? input_2
    ?--------- ? ? ? ?            ? input_3
    ... (n-4 lines omitted) 
    ?--------- ? ? ? ?            ? input_n

    although if bob does this, he gets:

    -rwxrwxrwx 1 bob bob  269 May 24  input_1
    ... (n-2 lines omitted) 
    -rwxrwxrwx 1 bob bob 2.0K Jan 19  input_n


  • Is there a simple explanation for this apparently (to me) inconsistent behavior?
  • Where do I go from here?
share|improve this question
Maybe a time for a refreshing reboot / fsck? – mdpc Oct 26 '12 at 20:22
Do you have permission to /home/share/inputs? Meaning, can you cd there? – Hai Vu Oct 26 '12 at 21:26
@HaiVu no. I thought chmod a+r * would be sufficient. – David LeBauer Oct 26 '12 at 22:02
Go with Chris Card's solution: you need access to /home/bob/inputs (i.e. must be able to cd into it). – Hai Vu Oct 29 '12 at 13:53
up vote 4 down vote accepted

You need execute permissions on /home/bob/inputs. You can set it with:

chmod a+x /home/bob/inputs
share|improve this answer
Getting bob to chmod a+rwx /home/bob/inputs was the solution. – David LeBauer Oct 26 '12 at 22:04
You don't need w. – Jim Paris Oct 26 '12 at 22:08
You don't need r either. – kubanczyk Oct 26 '12 at 22:48
You will need r permission if you want to access files in this directory, or sub directories below it. – Hai Vu Oct 29 '12 at 13:56
@HaiVu On the contrary - you need x (execute) permission to be able to access files in that directory - the r permission is needed to able to list the contents of the directory itself (just the file names). To see the permissions of each of the files, you need x on the directory - that is why there are question marks in OP's ls output. – rozcietrzewiacz Oct 30 '12 at 11:58

Run ls -ld /home/bob/inputs/. I think you'll find that bob gave you read permission on the directory, but not execute permission, i.e. something like drwxr--r--. On a directory, read permission lets you see the list of files while execute permission lets you access files in the directory. There are rare circumstances where it's useful to make a directory executable and not readable; the contrary is pretty useless. Almost all the time, a directory should either be accessible (readable and executable) or not accessible (neither readable nor executable).

See Why do directories need the executable (X) permission to be opened? for more explanations.

Remedy: ask bob to run chmod a+rx ~/inputs.

share|improve this answer

Your Answer


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.