Files
obsidian-vault/06 平台与配置/使用Remmina登陆远程服务器.md
2026-06-23 00:24:32 +08:00

115 lines
3.9 KiB
Markdown
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#软件配置 #linux
你遇到的“用户名和密码”提示问题,很可能是因为 **Remmina 未正确识别私钥​**​或​**​服务器端用户认证配置不匹配​**​导致的。以下是具体原因和解决方案,结合腾讯云机制分析:
---
### ⚠️ 问题根源分析
1. **​私钥绑定不生效​**
- 腾讯云生成的私钥(`.pem` 文件)需与服务器严格绑定。若未在控制台将密钥对关联到实例,服务器不会认可该私钥。
- **​权限问题​**​:私钥文件权限过宽(如 `644`)会被 SSH 拒绝使用,需设为 `600`
2. **​用户名填写错误​**
- 腾讯云不同镜像的默认用户名不同:
- Ubuntu`ubuntu`
- CentOS`centos`
- Debian`debian`
若在 Remmina 中填写 `root` 或其他用户名,而服务器未配置该用户,会导致认证失败。
3. **​服务器未关闭密码登录​**
- 腾讯云绑定密钥对后​**​默认禁用密码登录​**​。若强制弹出密码框,可能是私钥未生效,或服务器未应用新配置。
---
### 🔧 解决方案(逐步操作)
#### ✅ 第一步:确认腾讯云密钥绑定状态
1. 登录腾讯云控制台 → **​云服务器​** → 选择目标实例。
2. 进入 **​密钥对​** 标签页 → 检查是否已绑定你的密钥对。
⚠️ 若未绑定,需关机后绑定密钥(操作前备份数据)。
#### ✅ 第二步:检查 Remmina 配置
1. **​协议选择​**`SSH - Secure Shell`
2. **​服务器​**​:公网 IP。
3. **​用户名​**
- Ubuntu 镜像填 `ubuntu`
- CentOS 填 `centos`
(⚠️ 非自己设定的用户名!)
4. **​密钥指定​**
- 认证类型:​**​公钥​****​私钥文件​**​。
- 点击文件夹图标 → 选择腾讯云下载的 `.pem` 私钥文件。
5. **​密码栏留空​** → 保存配置。
#### ✅ 第三步:修复私钥权限(关键!)
```
# 本地终端执行(替换 your-key.pem 为实际路径)
chmod 600 ~/Downloads/your-key.pem # 限制仅当前用户可读
```
#### ✅ 第四步:验证服务器端配置
1. 通过腾讯云 **VNC 登录​**​(无需密钥)进入服务器。
2. 检查公钥是否注入:
```
cat ~/.ssh/authorized_keys # 应显示腾讯云绑定的公钥内容
```
3. 检查权限:
```
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys # 权限错误会导致密钥失效
```
#### ✅ 第五步:测试连接(命令行调试)
```
ssh -i /path/to/your-key.pem ubuntu@服务器IP # 替换为你的信息
```
- 若成功 → Remmina 配置有误,检查用户名或密钥路径。
- 若失败 → 根据错误信息排查(如 `Permission denied (publickey)` 表示密钥未生效)。
---
### ⚡ 备选方案:临时启用密码登录(不推荐)
若急需登录但密钥仍无效:
1. 通过 VNC 登录服务器 → 编辑 SSH 配置:
```
sudo nano /etc/ssh/sshd_config
```
2. 修改参数:
```
PasswordAuthentication yes # 取消注释并改为 yes
```
3. 重启服务 → 在 Remmina 中使用​**​自定义密码​**
```
sudo systemctl restart sshd
```
⚠️ 完成后务必关闭密码登录并重新绑定密钥!
---
### 💎 总结
- **​用户名​**​是腾讯云预设的(如 `ubuntu`**​非自定义​**​。
- **​密码栏必须留空​** → Remmina 仅靠私钥认证。
- **​私钥权限 `600` 是硬性要求​**​,否则连接必败。
若按上述步骤操作仍失败,请通过腾讯云 VNC 检查 `/var/log/auth.log` 日志Ubuntu或 `/var/log/secure`CentOS定位具体认证错误。