Permissons to upload to directory and read directory


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.
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.


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.

sorry - typo:

   chmod 776 output
   chmod 766 output
   chmod 764 output              <-  corrected
   chmod 744 output
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):



Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
OWASP: Forgery and Phishing

Learn the techniques to avoid forgery and phishing attacks and the types of attacks an application or network may face.

use the command

chmod 744 output

your problem will be solved
rossh1977Author Commented:
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?


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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Unix OS

From novice to tech pro — start learning today.