macOS iterm2 ssh自动登录脚本

编程入门 行业动态 更新时间:2024-10-12 01:22:46

macOS iterm2 ssh自动登录<a href=https://www.elefans.com/category/jswz/34/1771291.html style=脚本"/>

macOS iterm2 ssh自动登录脚本

代码内容

将代码存在任意位置,文件扩展名为 .sh

将此脚本文件的权限提升。(使用 chmod +x xxx.sh 命令)

#!/usr/bin/expect -f
set user root
set host 121.xxx.xxx.xxx
set port 22
set password xxxxxxxxxx
set timeout 30
spawn ssh -p $port $user@$host
expect "*assword:*"
send "$password\r"
interact
expect eof

配置iTerm2

打开Profiles => 新建一个Profile => Command处配置为 上面脚本存放的位置

使用

打开你上面配置的Profile,就可以登录了

更多推荐

macOS iterm2 ssh自动登录脚本

本文发布于:2024-02-26 07:51:43,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1701779.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:脚本   自动登录   macOS   ssh

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!