 |
 |
Force permissions on files?
|
 |
|
 |
|
Professional Poster
Join Date: Apr 1999
Location: Copenhagen, Denmark
Status:
Offline
|
|
We are running a server app that makes hires and lores images from original images, but the resulting files are written with 644 permissions (which is normal).
How do I force files written in certain directories to have different permissions?
|
|
JLL
- My opinions may have changed, but not the fact that I am right.
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Dec 2001
Location: Atlanta, GA, USA
Status:
Offline
|
|
You can't force it. However, you can set the umask (see umask in the man pages) which will set the default mask for the user creating the files.
If the files are being created by lots of different users, you could set up a cron job running every minute that fixed the permissions if they're incorrect. Alternately, start up a daemon process that does something similar (something like this):
Code:
#!/bin/sh
dir="/uploads/"
while [ true ]; do
chmod -R 755 ${dir}
sleep 60
done
Of course, you'd probably want to run something like that as root to avoid permissions issues.
|
|
Mac Pro 2x 2.66 GHz Dual core, Apple TV 160GB, two Windows XP PCs
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Aug 2000
Location: Minneapolis, MN
Status:
Offline
|
|
Originally posted by Arkham_c:
You can't force it. However, you can set the umask (see umask in the man pages) which will set the default mask for the user creating the files.
If the files are being created by lots of different users, you could set up a cron job running every minute that fixed the permissions if they're incorrect. Alternately, start up a daemon process that does something similar (something like this):
Code:
#!/bin/sh
dir="/uploads/"
while [ true ]; do
chmod -R 755 ${dir}
sleep 60
done
Of course, you'd probably want to run something like that as root to avoid permissions issues.
Running something like that as root may fix the permissions errors, but would consitiute a security risk. Imagine someone being able to upload a file then know those permissions, then accessing it via the web or other to find a hole in your server. Its a possible entry point for hackers.
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Aug 2000
Location: Minneapolis, MN
Status:
Offline
|
|
This was copied from the macoshints forums:
Revise the ftp upload permissions in 10.2
_Mon, Sep 23 '02 at 08:54AM • from:
Anonymous
-----
For some reason in Mac OS X 10.2, the
default file permissions when uploading files via ftp
is set to 640. This results in the permission
"-rw-r-----". That is, the file can be read and
modified by the owner, read by those belonging to its
group, but others can't even read it. Naturally, this
causes problems when using ftp to upload files to a
web server.
In previous systems it defaulted to the more sensible
644, or "-rw-r--r--", which is also the system-wide
default. Apparently, ftpd does not follow the system's
UMASK setting. To change this for all users on the
machine you need to create a file in /etc/ called
ftpd.conf. In this file, add one line saying:
umask all 022
Save the file and restart the ftp server. This will
make uploaded files readable by all.
|
|
|
| |
|
|
|
 |
 |
|
 |
|
|
|
|
|

|
|
 |
Forum Rules
|
 |
 |
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
 |
 |
 |
 |
|
 |
|