diff options
| author | Eltrac <hi@guhub.cn> | 2026-02-05 15:45:36 +0800 |
|---|---|---|
| committer | Eltrac <hi@guhub.cn> | 2026-02-05 15:45:36 +0800 |
| commit | 7c52431fb1b625cdb64d11efd37fc94752507f0f (patch) | |
| tree | 7f6cefab2c2df2c189f6850ae672611a63bf96e1 | |
| parent | de33f13cdfb3ad8559e07502b216e0cb2088f77f (diff) | |
docs: new notes
| -rw-r--r-- | content/notes/ghostty-ssh-issue.md | 41 | ||||
| -rw-r--r-- | content/notes/ssh-keys-over-pswd.md (renamed from content/notes/reinforce-vps.md) | 0 |
2 files changed, 41 insertions, 0 deletions
diff --git a/content/notes/ghostty-ssh-issue.md b/content/notes/ghostty-ssh-issue.md new file mode 100644 index 0000000..45c82ac --- /dev/null +++ b/content/notes/ghostty-ssh-issue.md @@ -0,0 +1,41 @@ ++++ +title = "在 Ghostty 中使用 SSH 的问题" +date = 2026-02-05 15:44:45 +tags = ["运维", "Linux"] ++++ + +## 问题描述 + +我的主力终端模拟器是 [Ghostty](https://ghostty.org/),直接 SSH 到远程服务器可能遇到一些问题,比如无法打开 `htop`、使用 `systemctl` 查看服务的状态时会提示终端 `not fully functional`,一些颜色的显示也会有问题。 + +调查后发现原因来自 Ghostty 的 Terminfo(终端信息)。简单来说,Terminfo 是一种很老的格式,许多终端应用会通过读取 Terminfo 来确定终端的能力;如果应用程序不认识这个终端,可能会认为当前运行程序的终端缺少必要的能力,继而无法正常运行。 + +Ghostty 的终端信息是 `xterm-ghostty`,如果 SSH 到一台没有 Ghostty 的终端信息条目的机器上,可能会得到这样的提示: + +```shell +missing or unsuitable terminal: xterm-ghostty +Error opening terminal: xterm-ghostty. +WARNING: terminal is not fully functional +``` + +## 解决方案 + +根据 Ghossty 的文档,解决方案有两个,我使用的方法是修改环境变量,把 `TERM` 设置为另一个被广泛支持的终端,比如 `xterm-256color`。可以在 `.ssh/config` 里这样写。 + +``` +Host example + TERM=xterm-256color +``` + +这样远程服务器就会把 Ghostty 视作 256color,不会认为 Ghostty 缺少某些功能。 + +还有一种方法是把 Ghostty 的信息发送到远程服务器上。 + +```shell +infocmp -x xterm-ghostty | ssh YOUR-SERVER -- tic -x - +``` + +## 参考资料 + +- https://ghostty.org/docs/help/terminfo#ssh +- https://en.wikipedia.org/wiki/Terminfo diff --git a/content/notes/reinforce-vps.md b/content/notes/ssh-keys-over-pswd.md index a7c4f9c..a7c4f9c 100644 --- a/content/notes/reinforce-vps.md +++ b/content/notes/ssh-keys-over-pswd.md |
