I've written a script that now generates files based on information submitted through an HTML form. Everything works fine, but I can never seem to get the file permissions set correctly. I think my problem is that the script creates the file as user "99". I've tried to make changes to the files manually as "myusername" but I always get a permission denied.
My next guess was to use the chmod command in the script, so that hopefully this command would be issued as user "99".
chmod 0666, file.txt; #tried this way
system("chmod 666 file.txt"); #and this way
Neither one of these change the permissions. Basically, I'm not sure how to change the file permissions from within the script. There has to be a simple way and I'm just missing something.
One other thing...Is there a way to create a file as a different user, so that I don't have to deal with trying to change the permissions through the script? If so, how do I find out what my uid (etc) is? When ever files are created as user "99" I have to call up and get the root user to remove the files since my user doesn't have permissions. Big pain! Any suggestions? TIA
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.