1 yamamotoahua 2018-07-30 14:24:43 +08:00 $ vim /usr/local/bin/ssh-xxx |
2 yamamotoahua 2018-07-30 14:25:38 +08:00 #!/usr/bin/expect spawn ssh [-p port] IP expect "*password:" send "[password]\r" expect "*#" interact |
![]() | 3 iyaozhen OP @yamamotoahua 额,我不是要解决怎么登录的问题。我是机器太多记不住命令(快捷键) 比如我有 3 个业务,一个业务下面 10 台机器,设置快捷命令或者快捷键不是太方便 |
4 feiyuanqiu 2018-07-30 15:05:37 +08:00 用 profile ![]() ![]() |
5 yamamotoahua 2018-07-30 15:25:47 +08:00 @iyaozhen 是我理解错了。 @feiyuanqiu 这种 ssh 之后要求输入密码的怎么办?密码是随机生成的,不好记。 send text at start 里输入,然后手动复制粘贴有点不人性化。 |
6 feiyuanqiu 2018-07-30 15:39:48 +08:00 @yamamotoahua 公司允许把公钥传到服务器上,然后用私钥登录吗,可以的话,试试 ssh-copy-id [email protected] |
7 feiyuanqiu 2018-07-30 15:49:35 +08:00 @feiyuanqiu 或者可以装一个 sshpass 工具 https://gist.github.com/arunoda/7790979 然后在 Command 里面填上 sshpass -p 'YourPassword' ssh user@host |
8 feiyuanqiu 2018-07-30 16:09:00 +08:00 ![]() |
![]() | 9 hly9469 2018-07-30 16:11:02 +08:00 via iPhone ssh copy id 之后,在 zshrc 里做个 alias |
![]() | 10 wingoo 2018-07-30 16:15:10 +08:00 shuttle + sshpass |
![]() | 11 iyaozhen OP @hly9469 问题不在于别名,是机器太多,别名没啥用。最好就是一堆列表在那儿,我要哪个点哪个 @wingoo shuttle 这个比较符合需求,但是公司有跳板机,稍微有点麻烦,而且不太想脱离 iterm2 去操作 @feiyuanqiu profile 这个也算是另辟蹊径了,感觉不错 |
12 feiyuanqiu 2018-07-30 17:50:30 +08:00 ![]() @iyaozhen profile 就是干这事的 不同的环境用不同的 profile 配置,我本地和开发环境的 profile 都是暗色主题,连接生产环境的 profile 用亮色主题,再定一个 Badge,防止脑袋昏了搞错环境执行错命令,增加主机的时候复制一份,改一下主机地址就行 ![]() 用 profile 的 tag 做分组,实现同一个业务的 profile 都归集在一起,方便使用与管理 |
![]() | 13 iyaozhen OP @feiyuanqiu 感谢,原来是这样用的。之前只用了一个 profile,用作远程服务器环境,配置了 sz、rz 等 |
![]() | 14 Oneneuuu 2018-07-30 20:10:24 +08:00 via Android zsh,配合 ssh-config 实现补全 |
![]() | 15 mritd 2018-07-30 20:16:29 +08:00 via iPhone 跳板机是个好的应用场景哈,我回去研究研究 正在撸工具 |
![]() | 16 iyaozhen OP @JasonYo 跳板机除了能执行 ssh 啥也干不了 而且自动补全也不太适合我的场景,比如我把 web 的机器都 web-xxx 命名,但是 xxx 有很多,补全不完,还是要记忆。 profile+tag 更适合我,无脑点就行 |
![]() | 17 Oneneuuu 2018-07-30 22:19:55 +08:00 via Android 当你发现 web-xxx 如果很多的话,看着也有点累 |
![]() | 18 learnshare 2018-07-30 22:24:13 +08:00 机器太多,或许应该考虑做一个 Web 控制台,安全性做的高一点 |
19 moonsn 2018-09-11 16:23:34 +08:00 内搜一下 relay_auto_login |