first build nexus
This commit is contained in:
35
openclaw/knowledgebase/ubuntu2-ssh-config.md
Normal file
35
openclaw/knowledgebase/ubuntu2-ssh-config.md
Normal file
@@ -0,0 +1,35 @@
|
||||
# Ubuntu2 SSH 配置
|
||||
|
||||
## 背景
|
||||
Ubuntu2 需要能够通过 "ssh nas" 免密登录到 NAS。
|
||||
|
||||
## 步骤
|
||||
|
||||
### 1. 生成 SSH 密钥(如不存在)
|
||||
```bash
|
||||
ssh-keygen -t ed25519 -N "" -f ~/.ssh/id_ed25519
|
||||
```
|
||||
|
||||
### 2. 配置 ~/.ssh/config
|
||||
```bash
|
||||
Host nas
|
||||
HostName 192.168.3.17
|
||||
User shenwei
|
||||
IdentityFile ~/.ssh/id_ed25519
|
||||
```
|
||||
|
||||
### 3. 传输公钥到 NAS
|
||||
```bash
|
||||
# 方法1:使用 sshpass(需要安装)
|
||||
sshpass -p '密码' ssh -o StrictHostKeyChecking=no shenwei@192.168.3.17 'cat >> ~/.ssh/authorized_keys'
|
||||
|
||||
# 方法2:手动复制公钥内容
|
||||
cat ~/.ssh/id_ed25519.pub
|
||||
# 然后登录 NAS 追加到 ~/.ssh/authorized_keys
|
||||
```
|
||||
|
||||
### 4. 测试
|
||||
```bash
|
||||
ssh nas "echo success"
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user