Permissons to upload to directory and read directory

Posted on 2006-03-23
Last Modified: 2010-04-21

I'm having a problem setting permission for a directory using Unix, telnet.  I want to upload using a php script to a directory.  I then want to allow the user to browse this directory so i need to have the permission to read it.

Could someone give me the instructions for this.  Sof far i've been using:-

chmod o-rx output
setfacl -m user:nobody:-wx output
chmod g+w output

But it's not worked.
Question by:rossh1977
    LVL 11

    Expert Comment


    Since the apache process likely runs under the nobody user, and this will not be in the same user group as your home user, you will need to give world read and write rights to access the directory.  I cant be sure of this, since I dont know how your server is configured, or what users/groups are in play, so here's a strategy to find the correct permissioning model.

    Start with some slack permissions such as:

       chmod 777 output

    Then use the following commands in order, to find the tightest permission set that works for your server configuration:

       chmod 776 output
       chmod 766 output
       chmod 744 output
       chmod 744 output

    When you find one setting that will not allow either your upload or your browsing, revert to that last one that worked.

    Note - Don't bother with 'setfacl' unless you know exactly what you are doing, and remove any setfacl settings you have already created.
    LVL 11

    Expert Comment


    sorry - typo:

       chmod 776 output
       chmod 766 output
       chmod 764 output              <-  corrected
       chmod 744 output
    LVL 38

    Accepted Solution

    others has rx permission to a dir does mean they can read the files inside the dir!

    the file permisions must be readable for others as well.

    if the dir is for the webserver, and you want to allow the users can read the file in the shell (telnet, ssh login etc). the file permsions need to be:

    755 (for scripts)

    assume that you set:
    assume that out owned by fred and belong to nobody group
    chmod 755 output
    chmod g+s

    in your php script, you need to set umask to 022 before upload the file to make
    sure all the files are readable to the others.

    If you want to use ACL, please have a look at the links (tutorial in):



    Expert Comment

    use the command

    chmod 744 output

    your problem will be solved

    Author Comment

    Hi tried all your suggestion but none seem to do what i'm after.  I think this is a unix solaris system im connecting to via telnet.  yuzh i tried your suggestions but i'm stuck on the umask part can you explain a bit more?


    LVL 61

    Expert Comment

    No comment has been added to this question in more than 21 days, so it is now classified as abandoned.
    I will leave the following recommendation for this question in the Cleanup topic area:

    Accept yuzh #16276683

    Any objections should be posted here in the next 4 days. After that time, the question will be closed.

    EE Cleanup Volunteer

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    I have been running these systems for a few years now and I am just very happy with them.   I just wanted to share the manual that I have created for upgrades and other things.  Oooh yes! FreeBSD makes me happy (as a server), no maintenance and I al…
    About FreeBSD Jails In FreeBSD, jails are a way of doing operating system level virtualization.  The basis of FreeBSD jails is chroot (, which changes the root directory of processes.  As a…
    Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
    This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now