• Что бы вступить в ряды "Принятый кодер" Вам нужно:
    Написать 10 полезных сообщений или тем и Получить 10 симпатий.
    Для того кто не хочет терять время,может пожертвовать средства для поддержки сервеса, и вступить в ряды VIP на месяц, дополнительная информация в лс.

  • Пользаватели которые будут спамить, уходят в бан без предупреждения. Спам сообщения определяется администрацией и модератором.

  • Гость, Что бы Вы хотели увидеть на нашем Форуме? Изложить свои идеи и пожелания по улучшению форума Вы можете поделиться с нами здесь. ----> Перейдите сюда
  • Все пользователи не прошедшие проверку электронной почты будут заблокированы. Все вопросы с разблокировкой обращайтесь по адресу электронной почте : info@guardianelinks.com . Не пришло сообщение о проверке или о сбросе также сообщите нам.

Passwordless SSH Setup in 5 Minutes

Sascha Оффлайн

Sascha

Заместитель Администратора
Команда форума
Администратор
Регистрация
9 Май 2015
Сообщения
1,549
Баллы
155


Tired of typing passwords every time you log into a server via SSH? Passwordless SSH authentication using SSH keys is the way to go. It’s secure, efficient, and saves you time. In this guide, I’ll walk you through setting it up in just 5 minutes. Let’s dive in!

Prerequisites

  • Two machines: One to act as the client (your local machine) and another as the server (remote machine).
  • SSH installed on both devices (most Linux/macOS systems have it pre-installed).
  • Basic Linux/macOS command-line knowledge.
Step 1: Generate an SSH Key Pair on Your Client


Open your terminal and run:


ssh-keygen -t rsa -b 4096



  • Press Enter to accept the default file location (~/.ssh/id_rsa).
  • You can skip setting a passphrase for simplicity, but it’s recommended for added security.

This creates two files:

  • ~/.ssh/id_rsa: Your private key (keep this secret).
  • ~/.ssh/id_rsa.pub: Your public key (this will be placed on the server).
Step 2: Copy the Public Key to the Server


Use the ssh-copy-id command to install your public key on the server:


ssh-copy-id user@server_ip



  • Replace user with your server username (e.g., ubuntu, root).
  • Replace server_ip with the server’s IP address or hostname.

You’ll be prompted to enter your server’s password once, after which your public key is copied to ~/.ssh/authorized_keys on the server.

Step 3: Test Passwordless Login


Try logging in to verify it works:


ssh user@server_ip



  • If successful, you’ll be connected to the server without a password prompt!
Troubleshooting


If you still need a password, check these common issues:

  1. Permissions: Ensure your client’s ~/.ssh folder is 700 and the private key (id_rsa) is 600.
  2. Server-side config: Verify PubkeyAuthentication yes is enabled in ~/.ssh/authorized_keys on the server.
  3. Firewall: Ensure port 22 (default SSH port) is open on the server.
Bonus: Secure Your Private Key

  • Protect the private key (id_rsa) with a passphrase (openssl can help reset one if needed).
  • Store it securely—never share it or commit it to public repositories.
Conclusion


In under 5 minutes, you’ve eliminated passwords from your SSH workflow! This method is widely used in DevOps, cloud servers, and automation pipelines. Just remember to keep your private key safe and rotate it periodically if compromised.

Got questions? Drop them below! Happy hacking! 🚀


Related Tags: SSH, Linux, Security, DevOps, Cloud, Automation

Note: This guide assumes you’re using OpenSSH. For Windows users, use PuTTY or OpenSSH for Windows.



Источник:

Пожалуйста Авторизируйтесь или Зарегистрируйтесь для просмотра скрытого текста.

 
Вверх Снизу