DE | EN

Create an SSH Key Pair on a Mac and Establish an SSH Connection

Step 1: Create and Copy the Public SSH Key

  1. Open the Terminal: Start the Terminal on your Mac by pressing Cmd + Space, typing "Terminal", and then pressing Enter.
  2. Generate the SSH key pair: Enter the following command in the Terminal to generate a new SSH key pair:
    Shell
    ssh-keygen -t rsa -b 4096
    Press Enter to accept the default path (/Users/yourusername/.ssh/id_rsa), and do not set a password when prompted.
  3. Open your public key for verification: Open the public key with a simple command in the Terminal:
    Shell
    open -a TextEdit ~/.ssh/id_rsa.pub
    This opens the file in TextEdit, a simple text editor.
  4. Copy the public key to the clipboard: Once the file is open in TextEdit, use Cmd + A to select all the text and then Cmd + C to copy it.

Step 2: Establish an SSH Connection to the Server

To establish an SSH connection to the server 89.58.62.146, use the following command in the Terminal. Replace username with your actual username on the server:

Shell
ssh username@89.58.62.146

This command initiates an SSH connection using your private key. If you are connecting for the first time, you may be prompted to confirm the authenticity of the host by typing yes.