把SSH登陆,写进一个shell脚本
然后使用alias 自定义一个调用这个脚本的命令,比如:
alias as = xxx
[root@linuxprobe ~]# ssh 192.168.10.20
The authenticity of host '192.168.10.20 (192.168.10.20)' can't be established.
ECDSA key fingerprint is 4f:a7:91:9e:8d:6f:b9:48:02:32:61:95:48:ed:1e:3f.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.10.20' (ECDSA) to the list of known hosts.
root@192.168.10.20's password:此处输入远程主机root用户的密码
Last login: Wed Apr 15 15:54:21 2017 from 192.168.10.10
[root@linuxprobe ~]#
[root@linuxprobe ~]# exit
logout
Connection to 192.168.10.10 closed.
#你可以看看linuxprobe.com 第四章,讲SHELL编程的,SSH代码直接写脚本里面就OK。