Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Permissions problem 1

Status
Not open for further replies.

aimclicks

Programmer
Feb 7, 2005
17
US
Ok i am getting unexpected permissions problems. Basically when a script creates a data file file the permissions are set to 0644 and i am unable to do anything with it. I am not able to change permissions, or even download the file created by the script. I also see that when i run

ls -l filename
i get apache for both ownerships



Thanks
 
Basically when a script creates a data file (...) i get apache for both ownerships
A cgi script ?
Ask the sysadmin.


Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Yes it is cgi and i am the sysadmin. I wish i wasn't today though. What would i need to do to solve this.
 
I am not able to change permissions
And you're the sysadmin ?
man chmod
man chown
man chgrp

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Ok, the problem is that i need the script to generate data files correctly instead of just chmod each file as a su. Unless can i set a directory where the data files generate in correctly?
 
man umask

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Ok, i ran it, i don't know if it worked i will have to test. Thanks for your help
 
Oh sorry i ran the umask command in the parent directory to all the folders i needed to be used
 
i must have done this wrong it didn't work


So i went in the folder i wanted to change and did
umask 011

and i still couldn't do chmod for files in folder under that
 
PHV gave you all you should need. The "umask" command doesn't change permissions, it sets a default for permissions of files that are yet to be created. In other words, the script (or process) on your system which creates the files should have a "umask" command to control permissions on files it creates.

"umask 000" is wide open, "umask 777" is the most restrictive.

The values correspond to the permissions you wish to block.
You will probably need to add "umask 011" (or similar) to the script which starts Apache, then restart. This certainly could be another script it the files are created via a cgi-bin script.
 
FYI subtract what permissions you want to get the umask. If you have an Apache user, and you have script that reads his startup files (.login, .profile, etc...) you can add the umask command there. You can also add it to the script that is running be careful with adding it in the CGI though. Also keep in mind security when setting the umask.

Let's say you want:

rw-rw-rw-
666
666
umask 000

rw-r--r--
666
044
umask 022

rw-rw-r--
666
004
umask 002
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top