Solved

How to get write permission through web/cgi?

Posted on 1997-05-31
5
179 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

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…
Recently I have been answering a lot of questions like this in IT forums that I frequent. The question posed is usually something along the lines of "We have software X installed and need to uninstall it for reason Y" or some other variant of the sa…
Learn the basics of modules and packages in Python. Every Python file is a module, ending in the suffix: .py: Modules are a collection of functions and variables.: Packages are a collection of modules.: Module functions and variables are accessed us…
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…

751 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