Is there an equivalent to ssh-copy-id with OpenSSH in Powershell?

239

I was on similar quest and seems like I've gone a bit overboard. You can find the powershell script here: https://github.com/VijayS1/Scripts/blob/master/ssh-copy-id/ssh-copy-id.ps1

Share:
239

Related videos on Youtube

Bobby
Author by

Bobby

Updated on September 18, 2022

Comments

  • Bobby
    Bobby over 1 year

    My intent is to deny users that do not meet a certain access level access to forms. I initially had issues with error code 3265 while writing the code for:

    TempVars("EmployeeType").Value = rs!EmployeeType_ID.Value

    This is no longer an issue; however, I cannot get access to the form even when the appropriate user is trying to enter. I've checked the spelling of table and column names multiple times as well.

    Below is my code for the login (where I'm using the tempvars), followed by the code in form Load().

    Option Compare Database
    Option Explicit
    
    Private Sub btnLogin_Click()
    Dim rs As Recordset
    
    Set rs = CurrentDb.OpenRecordset("Employees", dbOpenSnapshot, dbReadOnly)
    
    rs.FindFirst "UserName='" & Me.txtUserName & "'"
    
    If rs.NoMatch = True Then
        Me.lblWrongUser.Visible = True
        Me.txtUserName.SetFocus
        Exit Sub
    End If
    Me.lblWrongUser.Visible = False
    
    If rs!Password <> Me.txtPassword Then
        Me.lblWrongPass.Visible = True
        Me.txtPassword.SetFocus
        Exit Sub
    End If
    
    If IsNull(Me.txtUserName) Or IsNull(Me.txtPassword) Then
        MsgBox "You must enter password or login ID.", vbOKOnly + vbInformation, "Required Data"
        Me.txtUserName.SetFocus
        Exit Sub
    End If
    Me.lblWrongPass.Visible = False
    
    If rs!EmployeeType >= 4 Then
        Dim prop As Property
        On Error GoTo SetProperty
        Set prop = CurrentDb.CreateProperty("AllowBypassKey", dbBoolean, False)
    
        TempVars("UserName").Value = Me.txtUserName.Value
        TempVars("EmployeeType").Value = rs!EmployeeType_ID.Value
    
        CurrentDb.Properties.Append prop
    
    SetProperty:
        If MsgBox("Would you like to turn on the bypass key?", vbYesNo, "Allow Bypass") = vbYes Then
            CurrentDb.Properties("AllowBypassKey") = True
        Else
            CurrentDb.Properties("AllowBypassKey") = False
        End If
    
    End If
    
    Me.Visible = False
    DoCmd.OpenForm "frmMain"
    
    Globals.LoggingSignOn "Logon"
    
    End Sub
    
    Private Sub Form_Load()
    Me.txtUserName = Null
    Me.txtPassword = Null
    Me.txtUserName.SetFocus
    End Sub
    
    Private Sub Form_Unload(Cancel As Integer)
    Globals.LoggingSignOn "Logoff"
    End Sub
    
    Private Sub Form_Load()
        If Nz(DLookup("HasAccess", "tbl9EmployeeAccess", "EmployeeType_ID=" & TempVars("EmployeeType") & " FormName='" & Me.Name & "'"), False) = False Then
            MsgBox "You do not have access to access this location."
            DoCmd.Close acForm, Me.Name
        End If
    End Sub
    

    Thank you for your time, to anybody that looks into this.

    • Admin
      Admin over 11 years
    • Admin
      Admin over 11 years
      Their might be a way to do it that is more idiomatically powershell. Though the bulk of what is being done is on the server site. I believe I saw a .NET SSH client somewhere at one point in time, so you might be able to avoid using plink.