Solved

How to get write permission through web/cgi?

Posted on 1997-05-31
5
189 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: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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

In this tutorial I will show you how to provide a dynamic RTF document on your website generated with data from your database. For this tutorial you will need Microsoft Word or WordPad, WhizBase and Microsoft Access. In this tutorial I will show …
This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
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…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

630 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