?
Solved

Permissons to upload to directory and read directory

Posted on 2006-03-23
7
Medium Priority
?
299 Views
Last Modified: 2010-04-21
Hi,

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.
0
Comment
Question by:rossh1977
6 Comments
 
LVL 11

Expert Comment

by:siliconbrit
ID: 16276675

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.
0
 
LVL 11

Expert Comment

by:siliconbrit
ID: 16276677

sorry - typo:

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

Accepted Solution

by:
yuzh earned 2000 total points
ID: 16276683
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):
http:Q_21100569.html

and
http:Q_21292724.html

   
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Expert Comment

by:rochit85
ID: 16278232
use the command

chmod 744 output

your problem will be solved
0
 

Author Comment

by:rossh1977
ID: 16278508
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?

Thanks

Ross
0
 
LVL 62

Expert Comment

by:gheist
ID: 16514094
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.

gheist
EE Cleanup Volunteer
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Let's say you need to move the data of a file system from one partition to another. This generally involves dismounting the file system, backing it up to tapes, and restoring it to a new partition. You may also copy the file system from one place to…
A metadevice consists of one or more devices (slices). It can be expanded by adding slices. Then, it can be grown to fill a larger space while the file system is in use. However, not all UNIX file systems (UFS) can be expanded this way. The conca…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
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.
Suggested Courses
Course of the Month15 days, 9 hours left to enroll

850 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