当前位置:首页>Linux>linux服务器使用codex

linux服务器使用codex

  • 2026-09-06 20:13:52
linux服务器使用codex

1. ssh连接,免密码登录:

# 在 Linux 和 Mac 上                  ssh-keygen -t rsa -b 2048 -f ~/.ssh/id_rsa_linux          # 在 Windows 上         ssh-keygen -t rsa -b 2048 -f C:\Users\YourUsername\.ssh\id_rsa_windows

将生成的公钥(id_rsa_windows.pub的内容)添加到你远程服务器的.ssh/authorized_keys文件中,以允许连接。

C:\Users\YourUsername\.ssh\config  配置  IdentityFile        C:\Users\20813\.ssh\id_rsa_windows

以上参考:VSCode配置 SSH连接远程服务器+免密连接教程 - 知乎


2. 使用代理以及codex:

先本地登录codex,把本地的.codex/auth.json文件复制到服务器home文件夹相同路径下解决登录问题。

接下来是使用:

方法一:

Linux一键安装Clash

https://github.com/nelvko/clash-for-linux-install

(为什么公众号不能插入外部链接)

快捷方便,但是需要注意更改端口或者做隔离以防别的用户蹭代理(问AI)。

  1. 方法二:

  2. 在本地终端中输入ssh -R 9999:localhost:7890 用户名@主机IP -p 端口

  3. 打开服务器终端,输入proxy

在/home/username/.bashrc最后添加上

proxy() {   export http_proxy=http://localhost:9999   export https_proxy=http://localhost:9999   echo "Proxy has been set to localhost:9999" }  unproxy() {   unset http_proxy https_proxy   echo "Proxy has been disabled" }

同时在本地Clash中打开允许局域网连接入Clash

以上参考:解决服务器端VSCode插件(Codex)和终端网络访问问题 - 知乎

最新文章

随机文章