Ms access 如何在MS Access中保护后端?

Ms access 如何在MS Access中保护后端?,ms-access,Ms Access,如果我使用MS Access作为前端,要链接到后端的某些数据库,如何防止人们浏览相关文件夹并复制/删除数据库?有几个选项。请参阅此链接: 最好的选项是隐藏数据库浏览选项和密码保护数据库。有几个选项。请参阅此链接: 最好的选择是隐藏数据库浏览选项,并使用密码保护数据库。我就是这么做的。代码不是我的,我只是根据两个月的研究把它放在一起。但是,不要有错误的安全感,因为密码在连接字符串中,因此很容易被黑客攻击,您必须找到控制谁从另一个数据库链接到数据库的方法,否则他们仍然可以挖掘数据: 禁用对象菜单

如果我使用MS Access作为前端,要链接到后端的某些数据库,如何防止人们浏览相关文件夹并复制/删除数据库?

有几个选项。请参阅此链接:


最好的选项是隐藏数据库浏览选项和密码保护数据库。

有几个选项。请参阅此链接:


最好的选择是隐藏数据库浏览选项,并使用密码保护数据库。

我就是这么做的。代码不是我的,我只是根据两个月的研究把它放在一起。但是,不要有错误的安全感,因为密码在连接字符串中,因此很容易被黑客攻击,您必须找到控制谁从另一个数据库链接到数据库的方法,否则他们仍然可以挖掘数据:

  • 禁用对象菜单
  • 禁用功能区。使用AutoExec运行:hideEtheribbon()
  • 函数hideEtheribbon() DoCmd.ShowToolbar“Ribbon”,acToolbarNo 端函数

  • 禁用Shift键输入,例如,将代码放在“FRMBYPASSPOPTION”形式的OnClick偶数中。一定要把密码改成你能记住的,因为一旦这一切就绪,包括耶稣在内的任何人都无法进入密码库并更改密码 不允许使用键预览选项的F11键

    '***************** Code Start ***************
    'Assign this to the OnClick event of a command button (or double-click event
    'of a label or graphic) named "bDisableBypassKey"
    'Change the "TypeYourBypassPasswordHere" default password to your password
    
    Private Sub bDisableBypassKey_Click()
        On Error GoTo Err_bDisableBypassKey_Click
        'This ensures the user is the programmer needing to disable the Bypass Key
        Dim strInput As String
        Dim strMsg As String
    
        Beep
        strMsg = "Do you want to enable the Bypass Key?" & vbCrLf & vbLf & "Key password to enable Bypass Key."
        strInput = InputBox(Prompt:=strMsg, title:="Disable Bypass Key Password")
        If strInput = "carlo12a" Then
            SetProperties "AllowBypassKey", dbBoolean, True
            Beep
            MsgBox "Bypass Key has been enabled." & vbCrLf & vbLf & "Shift key will allow users to bypass startup" & _
                   "options next time database is opened.", _
                   vbInformation, "Set Startup Properties"
        Else
            Beep
            SetProperties "AllowBypassKey", dbBoolean, False
            MsgBox "Incorrect ''AllowBypassKey'' Password!" & vbCrLf & vbLf & "The Bypass Key was disabled." & vbCrLf & vbLf & _
                   "The Shift key will NOT allow the users to bypass the startup options the next time the database is opened.", _
                   vbCritical, "Invalid Password"
            Exit Sub
        End If
    
    Exit_bDisableBypassKey_Click:
        Exit Sub
    Err_bDisableBypassKey_Click:
        MsgBox "bDisableBypassKey_Click", Err.Number, Err.Description
        Resume Exit_bDisableBypassKey_Click
    End Sub
    '***************** Code End ***************
    
    将此代码置于公共模块下:

    '***************** Code Start ***************
    'Copy this function into a new public module.
    
    Option Compare Database
    Option Explicit
    
    Public Function SetProperties(strPropName As String, varPropType As Variant, varPropValue As Variant) As Integer
    
        On Error GoTo Error_Handler
    
        Dim db As DAO.Database, prp As DAO.Property
    
        Set db = CurrentDb
        db.Properties(strPropName) = varPropValue
        SetProperties = True
        Set db = Nothing
    
    Exit_SetProperties:
        Exit Function
    
    Error_Handler:
        If Err.Number = 3270 Then    'Property not found
            Set prp = db.CreateProperty(strPropName, varPropType, varPropValue)
            db.Properties.Append prp
            Resume Next
        Else
            SetProperties = False
            MsgBox "SetProperties", Err.Number, Err.Description
            Resume Exit_SetProperties
        End If
    End Function
    '***************** Code End ***************
    

    我就是这么做的。代码不是我的,我只是根据两个月的研究把它放在一起。但是,不要有错误的安全感,因为密码在连接字符串中,因此很容易被黑客攻击,您必须找到控制谁从另一个数据库链接到数据库的方法,否则他们仍然可以挖掘数据:

  • 禁用对象菜单
  • 禁用功能区。使用AutoExec运行:hideEtheribbon()
  • 函数hideEtheribbon() DoCmd.ShowToolbar“Ribbon”,acToolbarNo 端函数

  • 禁用Shift键输入,例如,将代码放在“FRMBYPASSPOPTION”形式的OnClick偶数中。一定要把密码改成你能记住的,因为一旦这一切就绪,包括耶稣在内的任何人都无法进入密码库并更改密码 不允许使用键预览选项的F11键

    '***************** Code Start ***************
    'Assign this to the OnClick event of a command button (or double-click event
    'of a label or graphic) named "bDisableBypassKey"
    'Change the "TypeYourBypassPasswordHere" default password to your password
    
    Private Sub bDisableBypassKey_Click()
        On Error GoTo Err_bDisableBypassKey_Click
        'This ensures the user is the programmer needing to disable the Bypass Key
        Dim strInput As String
        Dim strMsg As String
    
        Beep
        strMsg = "Do you want to enable the Bypass Key?" & vbCrLf & vbLf & "Key password to enable Bypass Key."
        strInput = InputBox(Prompt:=strMsg, title:="Disable Bypass Key Password")
        If strInput = "carlo12a" Then
            SetProperties "AllowBypassKey", dbBoolean, True
            Beep
            MsgBox "Bypass Key has been enabled." & vbCrLf & vbLf & "Shift key will allow users to bypass startup" & _
                   "options next time database is opened.", _
                   vbInformation, "Set Startup Properties"
        Else
            Beep
            SetProperties "AllowBypassKey", dbBoolean, False
            MsgBox "Incorrect ''AllowBypassKey'' Password!" & vbCrLf & vbLf & "The Bypass Key was disabled." & vbCrLf & vbLf & _
                   "The Shift key will NOT allow the users to bypass the startup options the next time the database is opened.", _
                   vbCritical, "Invalid Password"
            Exit Sub
        End If
    
    Exit_bDisableBypassKey_Click:
        Exit Sub
    Err_bDisableBypassKey_Click:
        MsgBox "bDisableBypassKey_Click", Err.Number, Err.Description
        Resume Exit_bDisableBypassKey_Click
    End Sub
    '***************** Code End ***************
    
    将此代码置于公共模块下:

    '***************** Code Start ***************
    'Copy this function into a new public module.
    
    Option Compare Database
    Option Explicit
    
    Public Function SetProperties(strPropName As String, varPropType As Variant, varPropValue As Variant) As Integer
    
        On Error GoTo Error_Handler
    
        Dim db As DAO.Database, prp As DAO.Property
    
        Set db = CurrentDb
        db.Properties(strPropName) = varPropValue
        SetProperties = True
        Set db = Nothing
    
    Exit_SetProperties:
        Exit Function
    
    Error_Handler:
        If Err.Number = 3270 Then    'Property not found
            Set prp = db.CreateProperty(strPropName, varPropType, varPropValue)
            db.Properties.Append prp
            Resume Next
        Else
            SetProperties = False
            MsgBox "SetProperties", Err.Number, Err.Description
            Resume Exit_SetProperties
        End If
    End Function
    '***************** Code End ***************
    

    您无法保护MS Access中的后端,以防有权使用它们的人。你只能把它们藏起来。Windows确实只支持签名应用程序的安全授权,但Access从未实现这些方法

    您可以通过以下方式阻止用户浏览相关文件夹:

    (1) (如其他答案中所述)隐藏文件夹的名称,以便人们不知道它们在哪里

    (2) 隐藏文件夹,以便人们在没有查看隐藏文件夹的权限时无法查看这些文件夹

    (3) 正在从顶级文件夹中删除“列出文件夹内容”权限,以便用户没有浏览到相关文件夹的权限


    您还可以通过从文件中删除删除权限来防止用户意外删除数据库。

    您无法在MS Access中保护后端,以防有权使用它们的用户。你只能把它们藏起来。Windows确实只支持签名应用程序的安全授权,但Access从未实现这些方法

    您可以通过以下方式阻止用户浏览相关文件夹:

    (1) (如其他答案中所述)隐藏文件夹的名称,以便人们不知道它们在哪里

    (2) 隐藏文件夹,以便人们在没有查看隐藏文件夹的权限时无法查看这些文件夹

    (3) 正在从顶级文件夹中删除“列出文件夹内容”权限,以便用户没有浏览到相关文件夹的权限


    您还可以通过从文件中删除删除权限来防止他人意外删除数据库。

    指定您使用的MS Access版本可能会有所帮助指定您使用的MS Access版本可能会有所帮助