前提
- 本地已经安装
sshpass
环境
▶ sshpass -V
sshpass 1.08
(C) 2006-2011 Lingnu Open Source Consulting Ltd.
(C) 2015-2016, 2021 Shachar Shemesh
This program is free software, and can be distributed under the terms of the GPL
See the COPYING file for more information.
Using "assword" as the default password prompt indicator.
- 本地已安装
zsh
配置
sshpass链接服务器命令:
sshpass -p ${password} ssh -p ${username}@${IP}
- 编辑~/.zshrc
echo alias ssh-to-xxx='sshpass -p password ssh username@hostname' >> ~/.zshrc
- 生效
source ~/.zshrc
- 登录服务器
ssh-to-xxx