# 啟動 SSH Server‌

## **啟動 SSH Server**

**雖然有以上方法叫出常用的按鍵能，但要方便使用，還是使用PC遠端登入管理最好用，所以，啟用一個ssh server的功能是相當重要的**

**apt可以改用pkg指令**

**$ apt update**\
**$ apt install openssh**

**$ ssh-keygen**

**ssh-keygen**&#x20;

**Generating public/private rsa key pair.**

**Enter file in which to save the key (/data/data/com.termux/files/home/.ssh/id\_rsa):**

**………..**

**cd .ssh**

**$ touch authorized\_keys**\
**$ cat id\_rsa.pub >> authorized\_keys**\
**$ chmod 600 authorized\_keys**\
**$ chmod 700 \~/.ssh**<br>

**啟動 SSH server(預設使用 8022 port)**

**sshd**

**# 偵錯模式**\
**$ sshd -d**\
\
**#停止 sshd**\
**$ pkill sshd** \ <br>

### **把產生的 id\_rsa 複製到遠端PC**

**cd .ssh**

**scp id\_rsa user\@yourPC:/home/user/**<br>

### **使用遠端PC登入termux**

**ssh 手機IP -i id\_rsa -p 8022**<br>

![](/files/-LklLE_qgBKPjPuNvMvu)


---

# 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://kawsing.gitbook.io/opensystem/andoid-shou-ji/termux/untitled.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.
