Home avatar

Building and implementing end-to-end solutions to solve real-world problems

Setting Up Windows SSH Server With Public Key Authentication

In this guide, we will walk you through the steps to set up an SSH server on a Windows system and configure it to use public key authentication instead of a password. This enhances security by eliminating the need for password-based access and relying on cryptographic keys for authentication.

Prerequisites

Before you start, ensure you have the following:

Fixing the Backtick Key Issue With Barrier From Mac Server to Windows 11 Client

If you’re experiencing issues with the backtick key (`) not working when using Barrier to connect a Mac Server to a Windows 11 Client, you’re not alone. This can be a frustrating problem, but fortunately, there is a solution.

Problem Description: When using Barrier, a software KVM (keyboard, video, mouse) switch, to control your Windows 11 Client from a Mac Server, the backtick key (`) might not function as expected. This issue can disrupt your workflow, especially if you rely on this key for tasks like entering command-line commands or writing code.

Add -- - After Tabs on VSCODE Using Regex-

To add “- " after tabs on Visual Studio Code (VSCode) using regex, you can follow these steps:

  1. Open VSCode.

  2. Press Ctrl + H (or Cmd + H on macOS) to open the Find and Replace panel.

  3. In the Find input box, input the following regular expression to match tabs at the beginning of each line:

    (^\t*)

    Make sure to enable the “Use Regular Expression” option by clicking the .* icon in the Find panel.

Check Apt Unattended Upgrades Will Run Today

To check if unattended upgrades will run today, you can use the systemctl list-timers command with the apt-daily.timer unit. This will provide information about the timer and when it is scheduled to run. Here’s how you can do it:

1
systemctl list-timers apt-daily.timer

Running this command will display output similar to the following:

Postgres Enable Password Login on Local

To enable password login on a local PostgreSQL database, you need to modify the pg_hba.conf file and then restart the PostgreSQL service. Here are the steps in markdown format:

1
2
3
4
5
6
## Enable Password Login on Local PostgreSQL

1. Open the `pg_hba.conf` file for editing using a text editor. You can use `vim` as you mentioned or any other text editor of your choice. Replace `/usr/local/var/postgres/pg_hba.conf` with the correct path to your `pg_hba.conf` file if it's located elsewhere.

   ```shell
   vim /usr/local/var/postgres/pg_hba.conf
  1. In the pg_hba.conf file, locate the line that corresponds to the local connection method. It typically looks like this:

User Story BDD Cucumber CRUD Operations Example

Basic

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
Feature: Create Employee

  Scenario: WITH ALL REQUIRED FIELDS IS SUCCESSFUL
  
    Given user wants to create an employee with the following attributes
      | id  | firstName | lastName | dateOfBirth | startDate  | employmentType | email               |
      | 100 | Rachel    | Green    | 1990-01-01  | 2018-01-01 | Permanent      | rachel.green@fs.com |

    And with the following phone numbers
      | id  | type   | isdCode | phoneNumber | extension |
      | 102 | Mobile | +1      | 2141112222  |           |
      | 103 | Office | +1      | 8362223000  | 333       |

    When user saves the new employee 'WITH ALL REQUIRED FIELDS'
    Then the save 'IS SUCCESSFUL'

Create Employee

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
Feature: Create Employee

  Scenario Outline: <testCase> <expectedResult>

    Given user wants to create an employee with the following attributes
      | id  | firstName   | lastName   | dateOfBirth   | startDate   | employmentType   | email   |
      | 110 | <firstName> | <lastName> | <dateOfBirth> | <startDate> | <employmentType> | <email> |

    And with the following phone numbers
      | id  | type   | isdCode | phoneNumber | extension |
      | 111 | Mobile | +1      | 2141112222  |           |
      | 112 | Office | +1      | 8362223000  | 333       |

    When user saves the new employee '<testCase>'
    Then the save '<expectedResult>'

    Examples:
      | testCase                 | expectedResult | firstName | lastName | dateOfBirth | startDate  | employmentType | email               |
      | WITHOUT FIRST NAME       | FAILS          |           | Green    | 1990-01-01  | 2018-01-01 | Permanent      | rachel.green@fs.com |
      | WITHOUT LAST NAME        | FAILS          | Rachel    |          | 1990-01-01  | 2018-01-01 | Permanent      | rachel.green@fs.com |
      | WITHOUT DATE OF BIRTH    | FAILS          | Rachel    | Green    |             | 2018-01-01 | Permanent      | rachel.green@fs.com |
      | WITHOUT START DATE       | FAILS          | Rachel    | Green    | 1990-01-01  |            | Permanent      | rachel.green@fs.com |
      | WITHOUT EMPLOYMENT TYPE  | FAILS          | Rachel    | Green    | 1990-01-01  | 2018-01-01 |                | rachel.green@fs.com |
      | WITHOUT EMAIL            | FAILS          | Rachel    | Green    | 1990-01-01  | 2018-01-01 | Permanent      |                     |
      | WITH ALL REQUIRED FIELDS | IS SUCCESSFUL  | Rachel    | Green    | 1990-01-01  | 2018-01-01 | Permanent      | rachel.green@fs.com |

Get Employee

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
Feature: Get Employee

  Background:

    Given an employee with the following attributes
      | id  | firstName | lastName | dateOfBirth | startDate  | employmentType | email               |
      | 200 | Rachel    | Green    | 1990-01-01  | 2018-01-01 | Permanent      | rachel.green@fs.com |

    And with the following phone numbers
      | id  | type   | isdCode | phoneNumber | extension |
      | 201 | Mobile | +1      | 2141112222  |           |
      | 202 | Office | +1      | 8362223000  | 333       |

    When employee already exists


  Scenario: GET BY ID

    When user wants to get employee by id 200
    Then the get 'IS SUCCESSFUL'
    
    And following employee is returned
      | id  | firstName | lastName | dateOfBirth | startDate  | employmentType | email               |
      | 200 | Rachel    | Green    | 1990-01-01  | 2018-01-01 | Permanent      | rachel.green@fs.com |

    And following employee phone numbers are returned
      | id  | type   | isdCode | phoneNumber | extension |
      | 201 | Mobile | +1      | 2141112222  |           |
      | 202 | Office | +1      | 8362223000  | 333       |

Update Employee

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
Feature: Update Employee

  Background:

    Given an employee with the following attributes
      | id  | firstName | lastName | dateOfBirth | startDate  | employmentType | email               |
      | 300 | Rachel    | Green    | 1990-01-01  | 2018-01-01 | Permanent      | rachel.green@fs.com |

    And with the following phone numbers
      | id  | type   | isdCode | phoneNumber | extension |
      | 301 | Mobile | +1      | 2141112222  |           |
      | 302 | Office | +1      | 8362223000  | 333       |

    When employee already exists


  Scenario Outline: <testCase> <expectedResult>

    Given user wants to update an employee with the following attributes
      | id   | firstName   | lastName   | dateOfBirth   | startDate   | employmentType   | email   |
      | <id> | <firstName> | <lastName> | <dateOfBirth> | <startDate> | <employmentType> | <email> |

    And with the following phone numbers
      | id  | type   | isdCode | phoneNumber | extension |
      | 301 | Mobile | +1      | 2141112222  |           |
      | 302 | Office | +1      | 8362223000  | 333       |

    When user saves the employee '<testCase>'
    Then the save '<expectedResult>'

    Examples:
      | testCase                 | expectedResult | id  | firstName | lastName | dateOfBirth | startDate  | employmentType | email               |
      | WITHOUT ID               | FAILS          |     | Rachel    | Green    | 1990-01-01  | 2018-01-01 | Permanent      | rachel.green@fs.com |
      | WITHOUT FIRST NAME       | FAILS          | 300 |           | Green    | 1990-01-01  | 2018-01-01 | Permanent      | rachel.green@fs.com |
      | WITHOUT LAST NAME        | FAILS          | 300 | Rachel    |          | 1990-01-01  | 2018-01-01 | Permanent      | rachel.green@fs.com |
      | WITHOUT DATE OF BIRTH    | FAILS          | 300 | Rachel    | Green    |             | 2018-01-01 | Permanent      | rachel.green@fs.com |
      | WITHOUT START DATE       | FAILS          | 300 | Rachel    | Green    | 1990-01-01  |            | Permanent      | rachel.green@fs.com |
      | WITHOUT EMPLOYMENT TYPE  | FAILS          | 300 | Rachel    | Green    | 1990-01-01  | 2018-01-01 |                | rachel.green@fs.com |
      | WITHOUT EMAIL            | FAILS          | 300 | Rachel    | Green    | 1990-01-01  | 2018-01-01 | Permanent      |                     |
      | WITH ALL REQUIRED FIELDS | IS SUCCESSFUL  | 300 | Rachel    | Green    | 1990-01-01  | 2018-01-01 | Permanent      | rachel.green@fs.com |

Delete Employee

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
Feature: Delete Employee

  Background:

    Given an employee with the following attributes
      | id  | firstName | lastName | dateOfBirth | startDate  | employmentType | email               |
      | 400 | Rachel    | Green    | 1990-01-01  | 2018-01-01 | Permanent      | rachel.green@fs.com |

    And with the following phone numbers
      | id  | type   | isdCode | phoneNumber | extension |
      | 401 | Mobile | +1      | 2141112222  |           |
      | 402 | Office | +1      | 8362223000  | 333       |

    When employee already exists


  Scenario: DELETE BY ID

    When user wants to delete employee by id 400
    Then the delete 'IS SUCCESSFUL'

References