1 Bingchunmoli 2022-02-02 22:43:57 +08:00 via Android ssh_config |
2 mschultz 2022-02-02 22:47:37 +08:00 ![]() Using the SSH Config File: https://linuxize.com/post/using-the-ssh-config-file/ |
![]() | 3 supahotfire OP @Bingchunmoli 大佬,是 vim 修改 ssh_config 里这个格式吗? Host vps (这里是自定义的 host 简称,以后连接远程服务器就可以用命令 ssh vps ) User 这里填用户名(如:root) HostName 这里填服务器地址也可以是域名(如:server.xxoo.com) Port 这里填服务器 open-ssh 端口(默认:22 ) IdentityFile 这里是刚刚生成的私钥文件地址(如~/.ssh/id_rsa ) IdentityFile 这块我就是不知道怎么填,甲骨文的公钥私钥都有,都在本地 |
![]() | 4 supahotfire OP @mschultz 谢谢大佬,我学习一下,大概知道怎么做,具体操作又不太会 |
![]() | 5 rabenda 2022-02-02 22:58:19 +08:00 ![]() |
![]() | 6 supahotfire OP @rabenda 谢谢大佬,我研究研究 |
7 Zhouisme 2022-02-02 23:06:10 +08:00 via Android 简单 alias |
8 GuuJiang 2022-02-02 23:30:45 +08:00 via iPhone 歪个楼,如无特殊需求,应该是多个主机共用一对密钥,把公钥添加到各个主机 |
![]() | 9 boris93 2022-02-02 23:30:52 +08:00 via iPhone ![]() |
![]() | 10 XTTX 2022-02-03 00:09:52 +08:00 ![]() 写个 make file, 同目录下建一个.envrc ``` include .envrc .PHONY:ssh-node1 ssh-node1: ssh -i ${SSHKEYLOCATION1} root@${REMOTE_IP1} .PHONY:ssh-node2 ssh-node2: ssh -i ${SSHKEYLOCATION2} root@${REMOTE_IP2} ``` .envrc export REMOTE_IP1=.............. export REMOTE_IP2=.............. export SSHKEYLOCATION1=C:\\Users\\xx\\.ssh\\gc\\id_rsa export SSHKEYLOCATION2=C:\\Users\\xx\\.ssh\\gc\\id_rsa |
![]() | 11 XTTX 2022-02-03 00:10:37 +08:00 vs code 开个 terminal, make ssh-node1 就连了 |
![]() | 12 GoodRui 2022-02-03 00:11:04 +08:00 ![]() |
![]() | 13 SteveLee 2022-02-03 00:19:58 +08:00 via iPhone @supahotfire IdentityFile 就是对应 host 的私钥文件路径 |
14 ltkun 2022-02-03 08:50:11 +08:00 via Android 直接两个脚本保存起来 不过不安全 最近在用 2fa 登录 ssh |
![]() | 15 supahotfire OP 感谢楼上各位大佬,本人不是码农相关专业的,有些教程对我来说还是有些门槛,只能慢慢研究学习了 |
16 jorneyr 2022-02-03 11:41:49 +08:00 ![]() iTerm 中使用 expect 脚本实现 ssh 自动登录: http://qtdebug.com/mac-iterm-ssh/ expect 是系统自带的脚本,不需要安装其他软件。 |
17 Bingchunmoli 2022-02-03 12:48:18 +08:00 via Android ![]() @supahotfire 公钥上传服务器改个 auth 开头的那个名字,私钥放本地默认用户目录下.ssh 可不写配置自动读取 |
![]() | 18 lecia 2022-02-06 14:42:50 +08:00 写入.ssh 文件夹下 |
![]() | 19 coagent 2022-02-07 23:44:41 +08:00 Tabby 比自带的终端好用多了呀,iTerm2 也比自带终端好用啊。 |