Web Hosting Forum | Lunarpages


*
Welcome, Guest. Please login or register.
Did you miss your activation email?



Login with username, password and session length
May 25, 2012, 12:05:29 PM

Pages: [1]   Go Down
  Print  
Author Topic: help help help with permissions please!  (Read 466 times)
dogpound
Intergalactic Cowboy
*****
Offline Offline

Posts: 71


WWW
« on: March 30, 2002, 01:02:00 PM »

I have several flat files (.txt) for data that I want my cgi programs to be able to read and write to.  But I don't want ppl from outside to be able to read, write to,  or  otherwise address these files through any other means.  

Where do I put these files and what permissions do I set for the directory and files to best accomplish this?

Please anybody and everybody help as soon as possible!   Thank you!!

Signed, the idiot newbie,
Dogpound
Logged
momo
Trekkie
**
Offline Offline

Posts: 11


WWW
« Reply #1 on: March 30, 2002, 04:45:00 PM »

Put them in the folder witht he script to execute unless stated otherwise.

use your ftp client (eg. cuteftp.com) to CHMOD the .txt files to 777.


which is
owner || group || public

[x]read || [x]read || [x]read
[x]write || [x]write || [x]write
[x]execute || [x]execute || [x]execute

or drwxrwxrwx

Hope this helps and good luck      

[ March 31, 2002: Message edited by: momo ]

[ March 31, 2002: Message edited by: momo ]

Logged
dogpound
Intergalactic Cowboy
*****
Offline Offline

Posts: 71


WWW
« Reply #2 on: March 30, 2002, 04:26:00 PM »

thank you so much for sharing your smarts!
will make changes as advised  
Logged
TWebMan
Quantum Encyclopedia Writer
*****
Offline Offline

Posts: 3112



WWW
« Reply #3 on: March 30, 2002, 10:37:00 PM »

If you want moreso to keep them out of the public eye, there's one of two things you can do.
1.  Put an .htaccess file in the directory that contains the scripts and txt files, and have that file simply say: Options -Indexes
OR (below is more secure)
2. Make a folder NEXT TO (at the same level of) your public_html directory, and put them in there.  This way they are unattainable through http and only through the file system.  You would, of course, have to set the proper path to the files in the perl scripts (which have to remain somewhere inside of cgi-bin).  The path would be /home/yourusername/folderyoucreate/filename.txt
In any case, you would probably need to set the permissions on the flat files to rw rw rw, though you can maybe try rw rw but I don't think that'll work.  Set the folder as stated in the post above.
Hope this helps!

[ March 31, 2002: Message edited by: TWebMan ]

Logged

"Computers cause people to make more mistakes than any other invention in history, with the possible exception of handguns and tequila."  - Unknown
"Liberty of any kind is seldom lost all at once." - D. Hume
Every day is an Ode to Joy
The planet will be fine... and so will your site
dogpound
Intergalactic Cowboy
*****
Offline Offline

Posts: 71


WWW
« Reply #4 on: April 01, 2002, 02:52:00 AM »

Webman, everything you say helps.  Even if I didn't know I needed to know, you say it and it helps.  

Thanks for the explanation.  
   

dogpound
Logged
pgil
Newbie
*
Offline Offline

Posts: 2


WWW
« Reply #5 on: July 28, 2002, 07:43:00 AM »

new to this, but trying to learn...

I´ve created a directory with permission 700, and a file inside with the same permission. Nobody form outside can read or write them, except myself, and my cgi programms can access them and modify them... is this ok??? or where am I getting it wrong??

thanks for any clarification!!!!!!!!
Logged
batkins
Spacescooter Operator
*****
Offline Offline

Posts: 47


WWW
« Reply #6 on: July 29, 2002, 01:32:00 AM »

of course no one can read it - 700 will deny access to anyone except you, the owner.  if u have a text file, its perms should be 644.  the directory it resides in should be 744.  look up chmod on google if u need more help.

 
quote:
Originally posted by pauldotcom:
new to this, but trying to learn...

I´ve created a directory with permission 700, and a file inside with the same permission. Nobody form outside can read or write them, except myself, and my cgi programms can access them and modify them... is this ok??? or where am I getting it wrong??

thanks for any clarification!!!!!!!!

Logged
Rowan
hamburglar
Über Jedi
*****
Offline Offline

Posts: 1919


I used to be Human....2.0b


WWW
« Reply #7 on: July 29, 2002, 04:45:00 PM »

4=read 2= write 1=execute
when you add these up you get a chmod value.
Add up the numbers for each group.
i.e 622 would allow the owner to read and write, but the group and all would only be able to write.
As someone said try 644 for your txt file, then just type its address into your browser and if you can read it change its permissions to something like 600
 
 [ July 30, 2002, 12:46 AM: Message edited by: human2.0 ]
Logged

pgil
Newbie
*
Offline Offline

Posts: 2


WWW
« Reply #8 on: August 01, 2002, 04:17:00 PM »

ok, THANKS for your explanations batkins & human2.0 !!!... but still have a doubt on the following: if I have a perl CGI program on my /cgi-bin/ dir, when someone (anyone) executes it through the web, the CGI program itself has "owner" rights?? or "group" rights?? or "anyone" rights??

...In other words, can the CGI program WRITE on a file with permission set to 600??

If thats the case, why do some suggest to set permission to 777 in order for a CGI script to MODIFY it??

THANKS!
Logged
batkins
Spacescooter Operator
*****
Offline Offline

Posts: 47


WWW
« Reply #9 on: August 01, 2002, 06:47:00 PM »

Your CGI program will run as you, i.e. the owner.  So if you own a CGI script and a text file and the text file has 600, you should be able to read and write it.

Anyone suggesting that you set permissions to 777 is either very dumb or very nasty.  Setting a file's permissions to 777 is a pretty bad idea - this will allow anyone with access to your server access to your files.  So, in other words, other LunarPages customers (like myself) could read and modify your file.  Needless to say, this is a Bad Thing.  You should give all your CGI scripts 755 permissions.

- batkins

 
quote:
Originally posted by pauldotcom:
ok, THANKS for your explanations batkins & human2.0 !!!... but still have a doubt on the following: if I have a perl CGI program on my /cgi-bin/ dir, when someone (anyone) executes it through the web, the CGI program itself has "owner" rights?? or "group" rights?? or "anyone" rights??

...In other words, can the CGI program WRITE on a file with permission set to 600??

If thats the case, why do some suggest to set permission to 777 in order for a CGI script to MODIFY it??

THANKS!

Logged
stephan
Guest
« Reply #10 on: August 01, 2002, 07:07:00 PM »

No way!!!

Are you sure other people can change your files when they are set to 777?   "[eek]"    "[eek]"    "[eek]"
Logged
lethalweapon
Galactic Royalty
*****
Offline Offline

Posts: 242


WWW
« Reply #11 on: August 02, 2002, 03:37:00 AM »

lol, the only problem with batkins suggestion is that he'll probably have to run it from the cpanel now.  cuz, otherwise, it assumes you're from the world.  (at least that's what happens when I do it.)  Anyway, with an htaccess file in the parent directory, he should be able to have a subdirectory, with 777 permissions, that noone should access, but the people he has permitted, right?  Hopefully the rest of the world understands what I'm saying, I have a habit of making no sense at all.  "[Smile]"
Logged
Pages: [1]   Go Up
  Print  
 
Jump to: