Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to protect my DBF files.

Status
Not open for further replies.

agussr

Programmer
Jun 19, 2002
13
ID
Dear all,

I have little probelm with my DBF files, someone could open my DBF file from workstation by excel...

I use NT server, that's way all my DBF files allways open in share directory.

That any body know, how to protect my DBF files from someone where do not have autorithy to open DBF files. And then my DBF files can not open from microsoft excel.

Thank you for all your kindly .

best regard's


Agus SR
 
Agus

It's difficult, if you have to give permissions for people to access the data you can't specify "only open it with xxxx". If people open and then save the data in Excel then it corrupts the DBF.

Ideas:
You could rename the dbf's to another extension - you would have to open them explicitly in the applications with this extension. This would stop users simply opening files with Excel although not the determined abusers.

You could make the directory that the DBF's are in hidden which would stop some users stumbling across it.

Make it a sackable offence in the organisation to tamper with the files!

Ian Boys
DTE Systems Ltd
 
the above is correct but you can also change the header of the dbf as well, this will be a more secure way of protecting your data. if you need a routine to ( open, close ) for this let me know



bobby
 
Dear Ian & Bobby

Thank you for your quick response...
I will try your best idea..

Thank's a lot...

regard's

agus sr
 
Dear Bobby,

If you don't mind,could you send the sample routine for open/close header DBF.

I will try your great idea.

thank you.

regard's

agus sr

my e-mail address pritari@cabi.net.id

 
Hi

A simpler method is to make use of the Directory and File permissions incorporated into NTFS:

Select the folder where the databases and indexes are stored.

Right click -> Properties -> Security -> Permissions

Select the user group you wish to deny access to..

Type of Access -> Special File Access -> Read + Write
Type of Access -> Special Directoy Access -> Write

Set Replace Permissions on Subdirectories &
Replace Permissions on Existing Files

All being well, the database program should still be able to read and write to the files, but any user trying to access the files through Explorer will get the following message

\\server\diretory is not accessible.
Access is denied

I would recommend testing this before implementing fully.

Regards.
 
Hi scal,
Is it not the problem that if everybody has to have access to the Clipper app then they also have access to the data via other apps? Does this solve the problem?

Ian Boys
DTE Systems Ltd
 
Here is a small coding the LOCK/OPEN DBF files in Current Directory.

#INCLUDE "FILEIO.CH"
DECLARE AFILES[ADIR("*.DBF")]
CLEAR SCREEN
TFLAG = .T.
@5,5 SAY 'OPEN FILES: ' GET TFLAG PICT 'Y'
READ
IF LASTKEY() = 27
RETURN
ENDIF
ADIR("*.DBF",AFILES)
FOR I= 1 TO LEN(AFILES)
@10,5 SAY 'FILE : '+AFILES
FER = 1
CNT = 1
DO WHILE FER<> 0
NH = FOPEN(AFILES,FO_READWRITE+FO_EXCLUSIVE)
FER = FERROR()
@24,0 SAY 'Trying to Open ..'+AFILES
CNT = CNT + 1
IF CNT>=1000
ANS = 0
TONE(500,1)
TONE(300,1)
TONE(500,1)
TONE(300,1)
DO WHILE ANS = 0
ANS = ALERT(&quot;OPEN ERROR !!!; TRY AGAIN&quot;,{&quot;YES&quot;,&quot;NO&quot;})
ENDDO
IF ANS = 1
CNT= 1
LOOP
ELSE
CANCEL
FLAG = .F.
EXIT
ENDIF
ENDIF
ENDDO
TLEN = 1
BUFF = SPACE(TLEN)
IF TFLAG
FREAD(NH,@BUFF,TLEN)
FSEEK(NH,0)
FWRITE(NH,CHR(3),TLEN)
ELSE
FREAD(NH,@BUFF,TLEN)
FSEEK(NH,0)
FWRITE(NH,CHR(0),TLEN)
ENDIF
FCLOSE(NH)
NEXT I
RETURN


S.Duraiappan

 
Dear Bobby,

I do encounter the same problem with agus sr. Right now, I'm actually am a VFP 7 user but I still have some old programs running in Clipper v.5.01 (would you believe that?) .... which may be migrated next year...Anyway, is it ok if you could send me your code at ctsinc@vzpacifica.net.

Thanks in advance,

VPF602
Greetings from N. Mariana Islands!
 
Hi,

There is no difficulty on protecting database-dbf-files.
First, open the file in a read-write format.
Retrieve f.e. 1024 bytes, put them in a buffer.
Hassle them in a unic way you know, fe begin with the last one an reverse it to the beginning.
Now save this modified buffer to the heading of your dbase-file.
Excell and other programms whom can read dbf-files, always look to the header of that file. All dadtabase-files own a specify header. When modifying this, Excell and other programm's can't read it anymore.
When you want to open the concerned DBF-file, you have to modify again the header, but thime in the reversed motion.
I did this already for more than 5 years, and still no-one found the undescripting method. It's easy, rapid and very strong.
I made a function with two parameters. One is the name of the databse-file, or just any file you want, The second parameter is indicating if you want to save the modified header (after closing the database), or if you want to put the correct header before opening that database-file.

So that is all theat must be done
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top