Solved

How to get write permission through web/cgi?

Posted on 1997-05-31
5
162 Views
Last Modified: 2013-12-25
Hi,
I am writing a cgi-perl script that need to open a file(new file),this script will work for all people who have accounts on our server,it should create file in their own home directory.I can check their login names and passwords(let's not worry about security about passwords here).I tried so hard just can not open a file even I made the owner of the script as root(superuser).But if I create a empty file before I run the script(give it write permission), it works!
I hope I do not have to make home directory writeable, and the files have to be in home directory.
Thanks.
shu
0
Comment
Question by:shuchunz
  • 3
  • 2
5 Comments
 
LVL 5

Accepted Solution

by:
julio011597 earned 100 total points
ID: 1828158
It doesn't matter who is the owner of the CGI script.
The script permissions say who can execute the script, but the script itself is run by the web server, which is often user nobody.

So user nobody runs a script which tries to create a file into a directory, and the directory permissions matter: in order to allow the CGI script to create a file, you must make the directory _writable_ to the user who runs the CGI; if the web server runs as user nobody, the directory must be writable by all (i.e. directory mode must be 777 - read, write, search by all).

HTH, julio
0
 

Author Comment

by:shuchunz
ID: 1828159
Thank you, Julio, your answer helps, but I and other people can not make their home directory writable, anyway I have tried what you suggested and it did work.
shu
0
 

Author Comment

by:shuchunz
ID: 1828160
Edited text of question
0
 
LVL 5

Expert Comment

by:julio011597
ID: 1828161
Hello shu,

i'm afraid you want get any further help on this subject, apart by me, since you accepted the answer and this has become a 'Previously Asked Question'.

About your problem, i may see one only work-around, which involves the system administrator's support:

on the target machine there should be a server application which runs as user root (or any other user who may have write permissions on your directories);

your CGI then connects to this server program (maybe through a socket), passing it user name and data to store into the file; the server prog at its turn creates the file in the right directory, possibly setting its owner and permissions, so that the user may then access it.

HTH, julio
0
 
LVL 5

Expert Comment

by:julio011597
ID: 1828162
Hello shu,

i'm afraid you want get any further help on this subject, apart by me, since you accepted the answer and this has become a 'Previously Asked Question'.

About your problem, i may see one only work-around, which involves the system administrator's support:

on the target machine there should be a server application which runs as user root (or any other user who may have write permissions on your directories);

your CGI then connects to this server program (maybe through a socket), passing it user name and data to store into the file; the server prog at its turn creates the file in the right directory, possibly setting its owner and permissions, so that the user may then access it.

HTH, julio
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

In this tutorial I will focus on how to use WhizBase as a tool for sending ICQ messages to ICQ. Here I will use a new technology in WhizBase, published in WhizBase 5.1 version. In this tutorial I will use 3 files, pager.wbsp for the processing, e…
It is a general practice to get rid of old user profiles on a computer  in a LAN environment. As I have been working with a company in a LAN environment where users move from one place to some other place at times. This will make many user profil…
Learn the basics of while and for loops in Python.  while loops are used for testing while, or until, a condition is met: The structure of a while loop is as follows:     while <condition>:         do something         repeate: The break statement m…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

863 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now