first build nexus

This commit is contained in:
billyshen
2026-03-23 20:57:45 +08:00
parent acb58c5684
commit e312026141
400 changed files with 52448 additions and 0 deletions

View File

@@ -0,0 +1,122 @@
# Mac Mini 配置 SSH 免密登录到 NAS
## 概述
本文档记录 Mac Mini (192.168.3.189) 配置 SSH 免密登录到 NAS (192.168.3.17) 的详细步骤。
## 前提条件
- Mac Mini 已安装 SSH 客户端(内置)
- NAS 已开启 SSH 服务
- 拥有 NAS 用户名和密码
## SSH 密钥配置
### 1. 生成 SSH 密钥(如不存在)
```bash
ssh-keygen -t ed25519 -N "" -f ~/.ssh/id_ed25519
```
### 2. 传输公钥到 NAS
```bash
# 方法1使用 sshpass需要安装
sshpass -p 'NAS密码' ssh -o StrictHostKeyChecking=no shenwei@192.168.3.17 'cat >> ~/.ssh/authorized_keys'
# 方法2手动复制
# 1. 查看公钥
cat ~/.ssh/id_ed25519.pub
# 2. 登录 NAS
ssh shenwei@192.168.3.17
# 3. 追加公钥到 authorized_keys
echo '公钥内容' >> ~/.ssh/authorized_keys
```
## ~/.ssh/config 配置
### 完整配置示例
```bash
# NAS
Host nas
HostName 192.168.3.17
User shenwei
IdentityFile ~/.ssh/id_ed25519
ProxyCommand none
# Ubuntu1
Host ubuntu1
HostName 192.168.3.47
User shenwei
IdentityFile ~/.ssh/id_ed25519
ProxyCommand none
# Ubuntu2
Host ubuntu2
HostName 192.168.3.45
User shenwei
IdentityFile ~/.ssh/id_ed25519
ProxyCommand none
# Mac Mini (本地)
Host macmini
HostName 192.168.3.189
User weishen
IdentityFile ~/.ssh/id_ed25519
ProxyCommand none
# VPS1
Host vps1
HostName 192.227.222.142
User root
IdentityFile ~/.ssh/id_ed25519
ProxyCommand none
# VPS2
Host vps2
HostName 104.194.92.188
User root
IdentityFile ~/.ssh/id_ed25519
ProxyCommand none
```
## 测试免密登录
```bash
# 测试 NAS 连接
ssh nas "echo success"
# 测试所有服务器
for server in macmini ubuntu1 ubuntu2 nas; do
ssh $server "echo $server OK"
done
```
## 已配置的服务器
| 主机 | IP | 用户 | 状态 |
|------|-----|------|------|
| nas | 192.168.3.17 | shenwei | ✅ 已配置 |
| ubuntu1 | 192.168.3.47 | shenwei | ✅ 已配置 |
| ubuntu2 | 192.168.3.45 | shenwei | ✅ 已配置 |
| macmini | 192.168.3.189 | weishen | ✅ 已配置 |
| vps1 | 192.227.222.142 | root | ✅ 已配置 |
| vps2 | 104.194.92.188 | root | ✅ 已配置 |
## 故障排查
### 问题Could not resolve hostname nas
**解决**:确保 ~/.ssh/config 中已添加 nas 别名配置
### 问题Permission denied
**解决**
1. 检查公钥是否已添加到目标服务器的 ~/.ssh/authorized_keys
2. 检查 ~/.ssh 目录权限应为 700
3. 检查 ~/.ssh/authorized_keys 权限应为 600
## 相关文档
- Ubuntu2 SSH 配置: [[openclaw/knowledgebase/ubuntu2-ssh-config]]