Forum Moderators: phranque

Message Too Old, No Replies

Make file readable to me and webserver only?

Need to 'secure' a file for myself and the webserver only...

         

Nick_W

4:58 pm on Jun 14, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi,

I need to store a password in a file, (no point using db as there is only one value) but I really need to make it only readable to myself and the webserver as it is a multi user system.

anyone know the chmod/chown combo I will need for that?

Cheers

Nick

ndjp

6:51 pm on Jun 14, 2002 (gmt 0)

10+ Year Member



Easy enough. The webserver will be accessing as a particular user and group. You need to find out what that group is, and the change the group of that file to the same group as the webserver. Then, the permissions need to be rw-rw----.. which means read and write for the user and the group and nothing for anyone else.

So, lets say the group is web, it would be:

chgrp web MYFILE
chmod 660 MYFILE (for future reference, write gets 4, read gets 2, and execute 1, hence 4+2=6).

You may want to look into encrypting that file somehow, what is it going to be used for?

Nick_W

6:58 pm on Jun 14, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks, I did work it out exactly as you said ;)

It's for a very simple news database for a one man company. I think it's enough as it is. Right tools for the job and all that: Anything more would be overkill.

Thanks very much

Nick