To add SSH keys for accessing your Ubuntu workstation from your Windows 11 machine, follow these steps:
-
Generate an SSH key on Windows 11:
- Open PowerShell or Command Prompt.
- Run the following command to generate a new SSH key pair:
ssh-keygen -t rsa -b 4096 -C "username@server_host"
- Follow the prompts to save the key (default location is usually fine) and set a passphrase if desired.
-
Copy the SSH public key to your Ubuntu workstation:
- Use the
ssh-copy-id
command to copy your public key to the Ubuntu workstation. Replaceusername
andhostname
with your actual username and the workstation's hostname or IP address:ssh-copy-id username@hostname
- If
ssh-copy-id
is not available on Windows, you can manually copy the key:- Display the public key with:
cat ~/.ssh/id_rsa.pub
- On your Ubuntu workstation, append the public key to the
~/.ssh/authorized_keys
file:echo "your_public_key" >> ~/.ssh/authorized_keys
- Ensure the correct permissions are set on the
authorized_keys
file:chmod 600 ~/.ssh/authorized_keys
- Display the public key with:
- Use the
-
Connect to your Ubuntu workstation:
- From your Windows 11 machine, use the
ssh
command to connect to your Ubuntu workstation:ssh username@hostname
- From your Windows 11 machine, use the
This process will add a new SSH key for your Windows 11 machine without modifying the SSH key access for your other computer.